Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Confused: JPA Tools >generate tables from entities
Confused: JPA Tools >generate tables from entities [message #435133] Mon, 12 January 2009 18:12 Go to next message
Wolfgang  is currently offline Wolfgang
Messages: 10
Registered: July 2009
Junior Member
Hi, the Dali "JPA tools>generate tables..." is not working for me. Perhaps
I am just missing a small thing:

in a new Eclipse (3.4.1) JPA-project I created one TestEntity and a
connection to an Oracle database. After I completed the TestEntity's
mapping I had error messages regarding the missing table and its two
missing attributes. So I tried to generate the table but this failed with
Internal Exception: java.sql.SQLException: [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified

so I added properties to the persistence.xml which created a different
error message.

I defined the project for a glassfish server which is shut down since I
prefer to create my tables directly with the database connection.

The database connection itself is ok because I can generate an entity from
a table with the JPA-tools entry in the context menu.

When I try to generate a table from the entity I see

a) an error message in the console:
Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for EntityManager named JPATestVF: The following
providers:
oracle.toplink.essentials.PersistenceProvider
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvi der
Returned null to createEntityManagerFactory.

at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
at org.eclipse.jpt.eclipselink.core.ddlgen.Main.execute(Main.ja va:77)
at org.eclipse.jpt.eclipselink.core.ddlgen.Main.main(Main.java: 65)

b) a status dialogue about a connection and refresh but the dialogue is
closed immediately, no more log entries created, still no table.

Just in case it adds value the persistence.xml is listed below, some
values replaced with <generics>

regards
Wolfgang

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="JPATestVF">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="Oracle"/>
<property name="eclipselink.jdbc.driver"
value="oracle.jdbc.OracleDriver"/>
<property name="eclipselink.jdbc.platform"
value=" org.eclipse.persistence.platform.database.oracle.OraclePlatf orm "/>
<property name="eclipselink.jdbc.url"
value="jdbc:oracle:thin:@<theserverip>:1521:<thesid>"/>
<property name="eclipselink.jdbc.user" value="<myuser>"/>
<property name="eclipselink.jdbc.password" value="<mypassword>"/>

<property name="eclipselink.logging.level" value="ALL"/>
<property name="eclipselink.logging.timestamp" value="true"/>
<property name="eclipselink.logging.exceptions" value="true"/>
<property name="eclipselink.logging.session" value="true"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode"
value="database"/>
</properties>
</persistence-unit>
</persistence>
Re: Confused: JPA Tools >generate tables from entities [message #435135 is a reply to message #435133] Tue, 13 January 2009 19:07 Go to previous messageGo to next message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
Hi,

I think the root of the problem here is that you are working with an
EclipseLink platform and EclipseLink properties, but actually using
TopLink Essentials in Glassfish. The second error message about not
finding a provider is because you have specified an EclipseLink provider
but TopLink Essentials is the provider you are using as it is the default
in Glassfish.

If you intend to use EclipseLink, you can use this in GlassFish instead of
the default provider (Essentials). EclipseLink will be the default
provider in GlassFish in the future (for Java EE 6 / JPA 2.0), so this
would probably be the best direction to go.

If you need help with using EclipseLink in Glassfish, the EclispeLink
newsgroup would be a good place to get help.

Let me know if you need more info on this.

Neil



Wolfgang wrote:

> Hi, the Dali "JPA tools>generate tables..." is not working for me. Perhaps
> I am just missing a small thing:

> in a new Eclipse (3.4.1) JPA-project I created one TestEntity and a
> connection to an Oracle database. After I completed the TestEntity's
> mapping I had error messages regarding the missing table and its two
> missing attributes. So I tried to generate the table but this failed with
> Internal Exception: java.sql.SQLException: [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified

> so I added properties to the persistence.xml which created a different
> error message.

> I defined the project for a glassfish server which is shut down since I
> prefer to create my tables directly with the database connection.

> The database connection itself is ok because I can generate an entity from
> a table with the JPA-tools entry in the context menu.

> When I try to generate a table from the entity I see

> a) an error message in the console:
> Exception in thread "main" javax.persistence.PersistenceException: No
> Persistence provider for EntityManager named JPATestVF: The following
> providers:
> oracle.toplink.essentials.PersistenceProvider
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvi der
> Returned null to createEntityManagerFactory.

> at
>
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
> at org.eclipse.jpt.eclipselink.core.ddlgen.Main.execute(Main.ja va:77)
> at org.eclipse.jpt.eclipselink.core.ddlgen.Main.main(Main.java: 65)

> b) a status dialogue about a connection and refresh but the dialogue is
> closed immediately, no more log entries created, still no table.

> Just in case it adds value the persistence.xml is listed below, some
> values replaced with <generics>

> regards
> Wolfgang

> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="JPATestVF">
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
> <properties>
> <property name="eclipselink.target-database" value="Oracle"/>
> <property name="eclipselink.jdbc.driver"
> value="oracle.jdbc.OracleDriver"/>
> <property name="eclipselink.jdbc.platform"
> value=" org.eclipse.persistence.platform.database.oracle.OraclePlatf orm "/>
> <property name="eclipselink.jdbc.url"
> value="jdbc:oracle:thin:@<theserverip>:1521:<thesid>"/>
> <property name="eclipselink.jdbc.user" value="<myuser>"/>
> <property name="eclipselink.jdbc.password" value="<mypassword>"/>

> <property name="eclipselink.logging.level" value="ALL"/>
> <property name="eclipselink.logging.timestamp" value="true"/>
> <property name="eclipselink.logging.exceptions" value="true"/>
> <property name="eclipselink.logging.session" value="true"/>
> <property name="eclipselink.ddl-generation" value="create-tables"/>
> <property name="eclipselink.ddl-generation.output-mode"
> value="database"/>
> </properties>
> </persistence-unit>
> </persistence>
Re: Confused: JPA Tools >generate tables from entities [message #435137 is a reply to message #435135] Wed, 14 January 2009 11:58 Go to previous message
Wolfgang  is currently offline Wolfgang
Messages: 10
Registered: July 2009
Junior Member
Neil,

thanks for the hint, that did it. Some details for future reference:
- created a user library eclipselink containing the eclipselink.jar
- used this library as default JPA implementation library (eclipse
preferences)
- made sure in project properties: JPA "Platform" = EclipseLink
- used the same persistence.xml as before
- a change of Glassgfish properties was not necessary
Now the console output for "generate tables" displays meaningful
information and confirms db-connection, the dialog shows up and when it is
closed the table is available.

regards
Wolfgang
Re: Confused: JPA Tools >generate tables from entities [message #613725 is a reply to message #435133] Tue, 13 January 2009 19:07 Go to previous message
Neil Hauge is currently offline Neil Hauge
Messages: 469
Registered: July 2009
Senior Member
Hi,

I think the root of the problem here is that you are working with an
EclipseLink platform and EclipseLink properties, but actually using
TopLink Essentials in Glassfish. The second error message about not
finding a provider is because you have specified an EclipseLink provider
but TopLink Essentials is the provider you are using as it is the default
in Glassfish.

If you intend to use EclipseLink, you can use this in GlassFish instead of
the default provider (Essentials). EclipseLink will be the default
provider in GlassFish in the future (for Java EE 6 / JPA 2.0), so this
would probably be the best direction to go.

If you need help with using EclipseLink in Glassfish, the EclispeLink
newsgroup would be a good place to get help.

Let me know if you need more info on this.

Neil



Wolfgang wrote:

> Hi, the Dali "JPA tools>generate tables..." is not working for me. Perhaps
> I am just missing a small thing:

> in a new Eclipse (3.4.1) JPA-project I created one TestEntity and a
> connection to an Oracle database. After I completed the TestEntity's
> mapping I had error messages regarding the missing table and its two
> missing attributes. So I tried to generate the table but this failed with
> Internal Exception: java.sql.SQLException: [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified

> so I added properties to the persistence.xml which created a different
> error message.

> I defined the project for a glassfish server which is shut down since I
> prefer to create my tables directly with the database connection.

> The database connection itself is ok because I can generate an entity from
> a table with the JPA-tools entry in the context menu.

> When I try to generate a table from the entity I see

> a) an error message in the console:
> Exception in thread "main" javax.persistence.PersistenceException: No
> Persistence provider for EntityManager named JPATestVF: The following
> providers:
> oracle.toplink.essentials.PersistenceProvider
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvi der
> Returned null to createEntityManagerFactory.

> at
>
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:154)
> at org.eclipse.jpt.eclipselink.core.ddlgen.Main.execute(Main.ja va:77)
> at org.eclipse.jpt.eclipselink.core.ddlgen.Main.main(Main.java: 65)

> b) a status dialogue about a connection and refresh but the dialogue is
> closed immediately, no more log entries created, still no table.

> Just in case it adds value the persistence.xml is listed below, some
> values replaced with <generics>

> regards
> Wolfgang

> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="JPATestVF">
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
> <properties>
> <property name="eclipselink.target-database" value="Oracle"/>
> <property name="eclipselink.jdbc.driver"
> value="oracle.jdbc.OracleDriver"/>
> <property name="eclipselink.jdbc.platform"
> value=" org.eclipse.persistence.platform.database.oracle.OraclePlatf orm "/>
> <property name="eclipselink.jdbc.url"
> value="jdbc:oracle:thin:@<theserverip>:1521:<thesid>"/>
> <property name="eclipselink.jdbc.user" value="<myuser>"/>
> <property name="eclipselink.jdbc.password" value="<mypassword>"/>

> <property name="eclipselink.logging.level" value="ALL"/>
> <property name="eclipselink.logging.timestamp" value="true"/>
> <property name="eclipselink.logging.exceptions" value="true"/>
> <property name="eclipselink.logging.session" value="true"/>
> <property name="eclipselink.ddl-generation" value="create-tables"/>
> <property name="eclipselink.ddl-generation.output-mode"
> value="database"/>
> </properties>
> </persistence-unit>
> </persistence>
Re: Confused: JPA Tools >generate tables from entities [message #613727 is a reply to message #435135] Wed, 14 January 2009 11:58 Go to previous message
Wolfgang  is currently offline Wolfgang
Messages: 10
Registered: July 2009
Junior Member
Neil,

thanks for the hint, that did it. Some details for future reference:
- created a user library eclipselink containing the eclipselink.jar
- used this library as default JPA implementation library (eclipse
preferences)
- made sure in project properties: JPA "Platform" = EclipseLink
- used the same persistence.xml as before
- a change of Glassgfish properties was not necessary
Now the console output for "generate tables" displays meaningful
information and confirms db-connection, the dialog shows up and when it is
closed the table is available.

regards
Wolfgang
Previous Topic:Confused: JPA Tools >generate tables from entities
Next Topic:Dali reports that some fields cannot be resolved
Goto Forum:
  


Current Time: Wed Oct 22 21:53:59 GMT 2014

Powered by FUDForum. Page generated in 0.14823 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software