Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Getting update DDL with SchemaManager
Getting update DDL with SchemaManager [message #872582] Wed, 16 May 2012 07:51 Go to next message
Eclipse UserFriend
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!

Re: Getting update DDL with SchemaManager [message #872669 is a reply to message #872582] Wed, 16 May 2012 11:10 Go to previous messageGo to next message
Eclipse UserFriend
No there doesn't seem to be a way other than to grab the SQL that gets logged. Please file a bug/feature request.

Best Regards,
Chris
Re: Getting update DDL with SchemaManager [message #872879 is a reply to message #872669] Wed, 16 May 2012 22:05 Go to previous messageGo to next message
Eclipse UserFriend
Thanks a lot!
I have created the following Bug/Feature Request #379774

I think it will be implemented in EclipseLink 2.4:
wiki.eclipse.org/EclipseLink/DesignDocs/368365

Thus I am not sure the new implemented feature will allow getting the Update DDL in a Writer...

Regards

Emmanuel Comba



Re: Getting update DDL with SchemaManager [message #873249 is a reply to message #872879] Thu, 17 May 2012 15:54 Go to previous messageGo to next message
Eclipse UserFriend
The feature as it stands for 2.4 will not use a writer - this is listed in the limitations in the design doc. The reason was that the feature requires database access, while the outputDDLToWriter methods are generally used when it is not connected.

Please remember to vote for 379774.

Best Regards,
Chris
Re: Getting update DDL with SchemaManager [message #873330 is a reply to message #873249] Thu, 17 May 2012 21:42 Go to previous message
Eclipse UserFriend
Thanks a lot, I have voted for it Wink
Previous Topic:how to use two @OneToMany and @ManyToOne to replace @ManyToMany
Next Topic:Update an Entity
Goto Forum:
  


Current Time: Tue Jul 15 16:25:40 EDT 2025

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

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

Back to the top