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
Constructors Constructor Description EclipseLinkSchemaGenerationProcessor(String persistenceProviderClassName)
Creates a new instance of EclipseLinkSchemaGenerationProcessor using Java2DBProcessorHelper
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeCreateDDL()
This method is called after the jdbc files have been created.Map<String,Object>
getOverridesForSchemaGeneration()
Map<String,Object>
getOverridesForSuppressingSchemaGeneration()
void
init(PersistenceUnitDescriptor pud, DeploymentContext context)
initialize the processorboolean
isContainerDDLExecutionRequired()
static boolean
isSupportedPersistenceProvider(String providerClassName)
This processor only supports EclipseLink, the default persistence povider in glassfish; or Toplink, the default provder for GF 2.x.
-
-
-
Constructor Detail
-
EclipseLinkSchemaGenerationProcessor
public EclipseLinkSchemaGenerationProcessor(String persistenceProviderClassName)
Creates a new instance of EclipseLinkSchemaGenerationProcessor using Java2DBProcessorHelper
-
-
Method Detail
-
init
public void init(PersistenceUnitDescriptor pud, DeploymentContext context)
Description copied from interface:SchemaGenerationProcessor
initialize the processor- Specified by:
init
in interfaceSchemaGenerationProcessor
- Parameters:
pud
- The PersistenceUnitDescriptor for pu being deployedcontext
- The deployment context
-
getOverridesForSchemaGeneration
public Map<String,Object> getOverridesForSchemaGeneration()
- Specified by:
getOverridesForSchemaGeneration
in interfaceSchemaGenerationProcessor
- Returns:
- overrides that will be supplied to EMF creation for schema generation
-
getOverridesForSuppressingSchemaGeneration
public Map<String,Object> getOverridesForSuppressingSchemaGeneration()
- Specified by:
getOverridesForSuppressingSchemaGeneration
in interfaceSchemaGenerationProcessor
- Returns:
- overrides that will be supplied to EMF creation for suppressing schema generation
-
isContainerDDLExecutionRequired
public boolean isContainerDDLExecutionRequired()
- Specified by:
isContainerDDLExecutionRequired
in 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:
executeCreateDDL
in interfaceSchemaGenerationProcessor
-
isSupportedPersistenceProvider
public static boolean isSupportedPersistenceProvider(String providerClassName)
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.
-
-