Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » DDL generation without database access
DDL generation without database access [message #378607] Wed, 06 August 2008 12:59 Go to next message
Frank Schwarz is currently offline Frank Schwarz
Messages: 25
Registered: July 2009
Location: Dresden
Junior Member
Is it possible to let EclipseLink write the SQL schema definition files
without accessing the database?

My approach so far still connects to the database:

String directory = args[0];
Map<String, String> properties = new HashMap<String, String>();
properties.put(PersistenceUnitProperties.DDL_GENERATION,
PersistenceUnitProperties.CREATE_ONLY);
properties.put(PersistenceUnitProperties.CREATE_JDBC_DDL_FIL E,
"create-tables.sql");
properties.put(PersistenceUnitProperties.DROP_JDBC_DDL_FILE,
"drop-tables.sql");
properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE ,
PersistenceUnitProperties.DDL_SQL_SCRIPT_GENERATION);
properties.put(PersistenceUnitProperties.APP_LOCATION, directory);
properties.put(PersistenceUnitProperties.JDBC_READ_CONNECTIO NS_MIN, "0");
properties.put(PersistenceUnitProperties.JDBC_WRITE_CONNECTI ONS_MIN, "0");

System.setProperty(PersistenceUnitProperties.JAVASE_DB_INTER ACTION,
"false");

EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("default", properties);
entityManagerFactory.createEntityManager().close();
entityManagerFactory.close();


Is there a best practice for this usecase?

Kind regards
Frank
Re: DDL generation without database access [message #378612 is a reply to message #378607] Wed, 06 August 2008 13:28 Go to previous messageGo to next message
James is currently offline James
Messages: 272
Registered: July 2009
Senior Member
EclipseLink will always connect to validate the login information and
connection. I don't know of any easy way to avoid any connection at all.
If you don't have any access to a database, you could just connect to a
dummy in-memory database, or use a SessionCustomizer to configure your own
dummy Connector in the EclipseLink DatabaseLogin.

-- James
Re: DDL generation without database access [message #379022 is a reply to message #378612] Wed, 06 August 2008 14:51 Go to previous message
Frank Schwarz is currently offline Frank Schwarz
Messages: 25
Registered: July 2009
Location: Dresden
Junior Member
I dared to create an enhancement request:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=243321

-- Frank
Previous Topic:many table, one entity, annotation driven?
Next Topic:Typesafe JPQL query in EclipseLink
Goto Forum:
  


Current Time: Thu Oct 30 23:59:37 GMT 2014

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

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