Getting update DDL with SchemaManager [message #872582] |
Wed, 16 May 2012 07:51  |
Eclipse User |
|
|
|
Hello,
For a project I need to get and display the create DDL and Update DDL for the entities included in an EAR on a J2EE Server (Glassfish).
With the following code I get the create DDL without problem:
...
Map<String, Object> properties = new HashMap<String, Object>();
// Enable DDL Generation
properties.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.NONE);
properties.put(PersistenceUnitProperties.CREATE_JDBC_DDL_FILE, "EclipseLink_DDL.sql");
properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_SQL_SCRIPT_GENERATION);
//eManager is the injected EntityManager with @PersistenceContext
ServerSession session = eManager.unwrap(ServerSession.class);
SchemaManager schemaManager = new SchemaManager(session);
schemaManager.setCreateSQLFiles(true);
StringWriter w = new StringWriter();
schemaManager.outputDDLToWriter(w);
schemaManager.createDefaultTables(true);
String s =w.toString();
...
Now I need the same to be able to generate an Update DDL. It seems the SchemaManager Class does not support it yet.
Is there a solution for that ?
Thanks a lot in advance!
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.55678 seconds