org.glassfish.persistence.jpa
Class JPAJava2DBProcessor

java.lang.Object
  extended by org.glassfish.persistence.jpa.JPAJava2DBProcessor

public class JPAJava2DBProcessor
extends java.lang.Object

For each persistence unit descriptors that is defined for an application create the ddl scripts. Additionally if the user has requested the tables to be created or dropped from the database complete that action too. These are the principles and expectations of the implementation. We don't want TopLink code to execute the DDLs, it should only generate them. So, we always set the *generation-mode* to *script* in the PUInfo object before passing it to createContainerEMF(). As a result TopLink never creates the actual tables, nor does it drop them. The DDLs are executed by our code based on user preference which considers inputs from persistence.xml and CLI. We set the TopLink property to DROP_AND_CREATE in that map because we want it to always generate both create- and dropDDL.jdbc files.

Author:
pramodg

Constructor Summary
JPAJava2DBProcessor(Java2DBProcessorHelper helper)
          Creates a new instance of JPAJava2DBProcessor using Java2DBProcessorHelper
 
Method Summary
 void createTablesInDB()
          This method is called after the jdbc files have been created.
 boolean isJava2DbPU(PersistenceUnitDescriptor bundle)
          This method does parses all relevant info from the PU
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPAJava2DBProcessor

public JPAJava2DBProcessor(Java2DBProcessorHelper helper)
Creates a new instance of JPAJava2DBProcessor using Java2DBProcessorHelper

Parameters:
helper - the Java2DBProcessorHelper instance to be used with this processor.
Method Detail

isJava2DbPU

public boolean isJava2DbPU(PersistenceUnitDescriptor bundle)
This method does parses all relevant info from the PU

Parameters:
bundle - the persistence unit descriptor that is being worked on.
Returns:
true if this PU requires java2db processing

createTablesInDB

public void createTablesInDB()
This method is called after the jdbc files have been created. Iterate over all created jdbc ddl files and execute it against the database to have the required objects created.



Copyright © 2012 GlassFish Community. All Rights Reserved.