openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marina Vatkina <Marina.Vatk...@Sun.COM>
Subject Using DDL generation in a Java EE environment?
Date Fri, 16 Mar 2007 00:01:00 GMT

I am part of the GlassFish persistence team and was wondering how does OpenJPA 
support JPA auto DDL generation (we call it "java2db") in a Java EE application 

Our application server supports java2db via creating two sets of files for each 
PU: a ...dropDDL.jdbc and a ...createDDL.jdbc file on deploy (i.e. before the 
application  is actually loaded into the container) and then executing 'create' 
file as the last step in deployment, and 'drop' file on undeploy or the 1st step 
in redeploy. This allows us to drop tables created by the previous deploy operation.

This approach is done for both, the CMP and the default JPA provider. It would 
be nice to add java2db support for OpenJPA as well, and I'm wondering if we need 
to do anything special, or it'll all work just by itself?

Here are my 1st set of questions:

1. Which API would trigger the process, assuming the correct values are 
specified in the persistence.xml file? Is it:
a) <provider>.createContainerEntityManagerFactory(...)? or
b) the 1st call to emf.createEntityManager() in this VM?
c) something else?

2. How would a user drop the tables in such environment?

3. If the answer to either 1a or 1b is yes, how does the code distinguish 
between the server startup time and the application being loaded for the 1st time?

4. Is there a mode that allows creating a file with the jdbc statements to 
create or drop the tables and constraints?

thank you,

View raw message