Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Getting update DDL with SchemaManager
Getting update DDL with SchemaManager [message #872582] Wed, 16 May 2012 11:51 Go to next message
Emmanuel Comba is currently offline Emmanuel Comba
Messages: 3
Registered: May 2012
Junior Member
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 15:10 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
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] Thu, 17 May 2012 02:05 Go to previous messageGo to next message
Emmanuel Comba is currently offline Emmanuel Comba
Messages: 3
Registered: May 2012
Junior Member
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 19:54 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
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] Fri, 18 May 2012 01:42 Go to previous message
Emmanuel Comba is currently offline Emmanuel Comba
Messages: 3
Registered: May 2012
Junior Member
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: Sat Oct 25 12:10:50 GMT 2014

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

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