[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.rt.eclipselink] DDL generation without database access
|
- From: fs5@xxxxxxx (Frank Schwarz)
- Date: Wed, 6 Aug 2008 12:59:12 +0000 (UTC)
- Newsgroups: eclipse.rt.eclipselink
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
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_FILE,
"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_CONNECTIONS_MIN, "0");
properties.put(PersistenceUnitProperties.JDBC_WRITE_CONNECTIONS_MIN, "0");
System.setProperty(PersistenceUnitProperties.JAVASE_DB_INTERACTION,
"false");
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("default", properties);
entityManagerFactory.createEntityManager().close();
entityManagerFactory.close();
Is there a best practice for this usecase?
Kind regards
Frank