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?

I thought that target-database property would be used, but I was wrong - the following properties required instead:
    /**
     * <p>If scripts are to be generated by the persistence provider and a
     * connection to the target database is not supplied, the
     * <code>"javax.persistence.database-product-name"</code> property must be
     * specified.</p>
     *
     * <p>The value of this property should be the value returned for the target
     * database by the JDBC DatabaseMetaData method getDatabaseProductName.</p>
     *
     * <p>If sufficient database version information is not included in the
     * result of this method, the <code>"javax.persistence.database-major-version"</code>
     * and <code>"javax.persistence.database-minor-version"</code> properties
     * should be specified as needed. These should contain the values returned
     * by the JDBC getDatabaseMajorVersion and getDatabaseMinor-Version methods
     * respectively.</p>
     */
    public static final String SCHEMA_DATABASE_PRODUCT_NAME = "javax.persistence.database-product-name";
   
    /**
     * <p>If sufficient database version information is not included from the
     * JDBC DatabaseMetaData method getDatabaseProductName, the
     * <code>"javax.persistence.database-major-version"</code> property should
     * be specified as needed. This should contain the value returned by the
     * JDBC getDatabaseMajor-Version method.</p>
     */
    public static final String SCHEMA_DATABASE_MAJOR_VERSION = "javax.persistence.database-major-version";
   
    /**
     * <p>If sufficient database version information is not included from the
     * JDBC DatabaseMetaData method getDatabaseProductName, the
     * <code>"javax.persistence.database-minor-version"</code> property should
     * be specified as needed. This should contain the value returned by the
     * JDBC getDatabaseMinor-Version method.</p>
     */
    public static final String SCHEMA_DATABASE_MINOR_VERSION = "javax.persistence.database-minor-version";

Thanks,
ANdrei
On 1/7/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