Class EclipseLinkSchemaGenerationProcessor
java.lang.Object
org.glassfish.persistence.jpa.schemageneration.EclipseLinkSchemaGenerationProcessor
- All Implemented Interfaces:
SchemaGenerationProcessor
public class EclipseLinkSchemaGenerationProcessor
extends Object
implements SchemaGenerationProcessor
SchemaGenerationProcessor that handles schema generation while running
against EclipseLink in pre JPA 2.1 mode 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
ConstructorsConstructorDescriptionEclipseLinkSchemaGenerationProcessor(String persistenceProviderClassName) Creates a new instance of EclipseLinkSchemaGenerationProcessor using Java2DBProcessorHelper -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called after the jdbc files have been created.voidinit(com.sun.enterprise.deployment.PersistenceUnitDescriptor pud, org.glassfish.api.deployment.DeploymentContext context) initialize the processorbooleanstatic booleanisSupportedPersistenceProvider(String providerClassName) This processor only supports EclipseLink, the default persistence povider in glassfish; or Toplink, the default provder for GF 2.x.
-
Constructor Details
-
EclipseLinkSchemaGenerationProcessor
Creates a new instance of EclipseLinkSchemaGenerationProcessor using Java2DBProcessorHelper
-
-
Method Details
-
init
public void init(com.sun.enterprise.deployment.PersistenceUnitDescriptor pud, org.glassfish.api.deployment.DeploymentContext context) Description copied from interface:SchemaGenerationProcessorinitialize the processor- Specified by:
initin interfaceSchemaGenerationProcessor- Parameters:
pud- The PersistenceUnitDescriptor for pu being deployedcontext- The deployment context
-
getOverridesForSchemaGeneration
- Specified by:
getOverridesForSchemaGenerationin interfaceSchemaGenerationProcessor- Returns:
- overrides that will be supplied to EMF creation for schema generation
-
getOverridesForSuppressingSchemaGeneration
- Specified by:
getOverridesForSuppressingSchemaGenerationin interfaceSchemaGenerationProcessor- Returns:
- overrides that will be supplied to EMF creation for suppressing schema generation
-
isContainerDDLExecutionRequired
public boolean isContainerDDLExecutionRequired()- Specified by:
isContainerDDLExecutionRequiredin interfaceSchemaGenerationProcessor- Returns:
- whether ddl needs to be executed by container
-
executeCreateDDL
public void executeCreateDDL()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.- Specified by:
executeCreateDDLin interfaceSchemaGenerationProcessor
-
isSupportedPersistenceProvider
This processor only supports EclipseLink, the default persistence povider in glassfish; or Toplink, the default provder for GF 2.x.- Returns:
- true if persistence provider is EclipseLink or Toplink.
-