DDL generation without database access [message #378607] |
Wed, 06 August 2008 12:59 |
Frank Schwarz Messages: 26 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03930 seconds