Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink generate DDL without DB connection?

By specifying the eclipselink DDL generation properties you are using the native DDL generation mechanism and not the JPA 2.1 one.

JPA 2.1 allows you to generate without a DB connection, therefore, you must specify only the following JPA properties instead:

javax.persistence.schema-generation.scripts.action=""> javax.persistence.schema-generation.scripts.create-target=createDDL.sql
javax.persistence.schema-generation.scripts.drop-target=dropDDL.sql

And remove the eclipselink DDL properties:

eclipselink.create-ddl-jdbc-file-name=createDDL.sql

eclipselink.ddl-generation.output-mode=sql-script

eclipselink.ddl-generation=drop-and-create-tables

eclipselink.drop-ddl-jdbc-file-name=dropDDL.sql

Cheers,
Guy

On 07/01/2015 7:46 PM, eclipselink-users.eclipse.org@xxxxxxxxxx wrote:

Unsuccessfull.

Persistence.generateSchema() uses an EntityManager too, and that one wants to have a JDBC driver and connection...

 

Not sure, if using an in-memory DB is the appropriate solution, as I think there might be slight differences to a target-database "Oracle". What do you think?

 

cheers

Leo

 

 

[DEBUG] javax.persistence.validation.mode=NONE

javax.persistence.transactionType=RESOURCE_LOCAL

eclipselink.target-database=Oracle

eclipselink.create-ddl-jdbc-file-name=createDDL.sql

eclipselink.ddl-generation.output-mode=sql-script

eclipselink.logging.level=FINEST

javax.persistence.jtaDataSource=null

javax.persistence.schema-generation.scripts.action="">

eclipselink.ddl-generation=drop-and-create-tables

eclipselink.drop-ddl-jdbc-file-name=dropDDL.sql

javax.persistence.nonJtaDataSource=null

javax.persistence.schema-generation.database.action="">

eclipselink.logging.logger=JavaLogger

 

[INFO] Generating schema for persistence unit pu-test

Jan 08, 2015 1:44:24 AM org.eclipse.persistence.session.file:/C:/devel/workspace_DLP/test-eclispelink-ddlgeneration-maven-plugin/src/main/resources/_pu-test_transactionType=RESOURCE_LOCAL

INFO: EclipseLink, version: Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5

Jan 08, 2015 1:44:24 AM org.eclipse.persistence.session.file:/C:/devel/workspace_DLP/test-eclispelink-ddlgeneration-maven-plugin/src/main/resources/_pu-test_transactionType=RESOURCE_LOCAL.ejb

SEVERE:

Local Exception Stack:

Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException

Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property

should be set to a class that is compatible with your database platform

        at org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:383)

        at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:91)

        at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)

        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:204)

        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setDatasourceAndInitialize(DatabaseSessionImpl.java:171)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:233)

        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:685)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)

        at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:140)

        at org.eclipse.persistence.jpa.PersistenceProvider.generateSchema(PersistenceProvider.java:209)

        at org.eclipse.persistence.jpa.PersistenceProvider.generateSchema(PersistenceProvider.java:241)

        at javax.persistence.Persistence.generateSchema(Persistence.java:114)

        at ch.lbreuss.mojo.eclipselink.DDLGeneratorThread.run(DDLGeneratorThread.java:50)

 

Exception in thread "Thread-1" javax.persistence.PersistenceException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException

Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property

should be set to a class that is compatible with your database platform

        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:766)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:182)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:527)

        at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:140)

        at org.eclipse.persistence.jpa.PersistenceProvider.generateSchema(PersistenceProvider.java:209)

        at org.eclipse.persistence.jpa.PersistenceProvider.generateSchema(PersistenceProvider.java:241)

        at javax.persistence.Persistence.generateSchema(Persistence.java:114)

        at ch.lbreuss.mojo.eclipselink.DDLGeneratorThread.run(DDLGeneratorThread.java:50)

Caused by: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException

Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].  Verify that you have set the expected driver class and URL.  Check your login, persistence.xml or sessions.xml resource.  The jdbc.driver property

should be set to a class that is compatible with your database platform

        at org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:383)

        at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:91)

        at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)

        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:204)

        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setDatasourceAndInitialize(DatabaseSessionImpl.java:171)

        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:233)

        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:685)

        ... 8 more

 

From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of eclipselink-users.eclipse.org@xxxxxxxxxx
Sent: Dienstag, 6. Januar 2015 16:06
To: 'EclipseLink User Discussions'
Subject: Re: [eclipselink-users] Eclipselink generate DDL without DB connection?

 

Thanks, I'll give it a try.

Eventually, I'll incorporate it into https://github.com/lbreuss/eclipselink-ddlgeneration-maven-plugin/

cheers

Leo

 

From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of andrei ilitchev
Sent: Dienstag, 6. Januar 2015 15:49
To: eclipselink-users@xxxxxxxxxxx
Subject: Re: [eclipselink-users] Eclipselink generate DDL without DB connection?

 

In Eclipselink 2.5 try newly defined in JPA 2.1 Persistence.generateSchema(String persistenceUnitName, Map map)
including into the map ddl generation properties as well as eclipselink.target-database property.

On 1/6/2015 7:16 AM, eclipselink-users.eclipse.org@xxxxxxxxxx wrote:              

Hi

is it possible to generate the DDLs without an actual DB connection?

If not, for what is the DB connection needed?

 

regards

Leo



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

 



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top