Thank you a lot marina, sorry to be such a noob but I think that JavaEE
is pretty though to digest (in my defense, I ordered the Java EE 5
Tutorial from Amazon, but I still have to receive it)!
Following the various advices I received:
1) I added my db to JDBC/Connection Pools as "database"
2) I added the connection pool to JDBC/JDBC Resources as "jdbc/database"
3) I modified the persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="
http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="databasePU">
<jta-data-source>jdbc/database</jta-data-source>
</persistence-unit>
</persistence>
4) I annotated the ejb with :
@PersistenceContext(unitName="databasePU")
private EntityManager em;
And now everything is working!
Thank you a lot to everyone!
Piero
glassfish_at_javadesktop.org wrote:
> When you switched from Persistence.createEntityManagerFactory to @PersistenceContext, you switched from Java SE style setup to Java EE. In the latter option you use <jta-data-source> element to specify the datasource, or the GlassFish server provides you with one (Derby/JavaDB that comes with it), but the jdbc properties are ignored.
>
> If you want to use Derby, start it <gf>/bin/asadmin start-database, otherwise create the connection pool and resource, and specify the resource name in the <jta-data-source> element of your persistence.xml.
>
> thanks,
> -marina
> [Message sent by forum member 'mvatkina' (mvatkina)]
>
> http://forums.java.net/jive/thread.jspa?messageID=234241
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>