Hi Tom
I am sending you the changes related to the following issues :
612 : ddl generation feature needs adjustment
Based on your suggestion the major changes are made to the "cmp"
module where we have code that deals with application deployment. I have
ensured that I have "createEntityManager()" call after the
createEntityManagerFactory() call. With this change in place I have
removed the method isDdlGenerationRequired() and calls to it.
File impacted :
glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/EntityManagerSetupImpl.java
901 : The jdbc files associated with java2db are recreated each time an
application is loaded
I am making use of the property
"toplink.ddl-generation.output-mode", that you had introduced when you
made the code changes in April-May timeframe.
The code changes that I have made are as follows :
1. in the "cmp" module when we are in the application deployment mode,
I would set the value of the toplink property
"toplink.ddl-generation.output-mode" to be
EntityManagerFactoryProvider.DDL_SQL_SCRIPT_GENERATION i.e. "sql-script".
2. in the "appserv-core" module when we load the application I would
sent this property to have a value of "none".
With these changes in place on the glassfish side Ido not have to make
any changes in the "entity-persistence" module. But as part of an
optimization I just added a check to return from the generateDdlFiles()
if the value of the property ""toplink.ddl-generation.output-mode" was
set to "none".
Thanks
Pramod
Index: src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java,v
retrieving revision 1.34
diff -r1.34 EntityManagerFactoryProvider.java
213a214,220
> String ddlGenerationMode = (String) getConfigPropertyAsString(DDL_GENERATION_MODE, props, DEFAULT_DDL_GENERATION_MODE);
> // In the case of Glassfish this value would be set to NONE explicitly at the
> // application loading time. Hence we check for NONE and exit.
> if (ddlGenerationMode.equals(NONE)) {
> return;
> }
>
218,220c225
< SchemaManager mgr = new SchemaManager(session);
<
< String ddlGenerationMode = (String) getConfigPropertyAsString(DDL_GENERATION_MODE, props, DEFAULT_DDL_GENERATION_MODE);
---
> SchemaManager mgr = new SchemaManager(session);
Index: src/java/oracle/toplink/essentials/internal/ejb/cmp3/EntityManagerSetupImpl.java
===================================================================
RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/EntityManagerSetupImpl.java,v
retrieving revision 1.38
diff -r1.38 EntityManagerSetupImpl.java
574,589d573
<
< public boolean isDdlGenerationRequired(Map m) {
< return isDdlGenerationRequired(m, true);
< }
<
< protected boolean isDdlGenerationRequired(Map m, boolean shouldMergeMap) {
< if(shouldMergeMap) {
< m = mergeWithExistingMap(m);
< }
< String str = EntityManagerFactoryProvider.getConfigPropertyAsStringLogDebug(EntityManagerFactoryProvider.DDL_GENERATION, m, session);
< if(str != null) {
< return !str.equalsIgnoreCase(EntityManagerFactoryProvider.NONE);
< } else {
< return false;
< }
< }
593c577
< return isValidationOnly(m, false) || isDdlGenerationRequired(m, false);
---
> return isValidationOnly(m, false);