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 Details

    • EclipseLinkSchemaGenerationProcessor

      public EclipseLinkSchemaGenerationProcessor(String persistenceProviderClassName)
      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: SchemaGenerationProcessor
      initialize the processor
      Specified by:
      init in interface SchemaGenerationProcessor
      Parameters:
      pud - The PersistenceUnitDescriptor for pu being deployed
      context - The deployment context
    • getOverridesForSchemaGeneration

      public Map<String,Object> getOverridesForSchemaGeneration()
      Specified by:
      getOverridesForSchemaGeneration in interface SchemaGenerationProcessor
      Returns:
      overrides that will be supplied to EMF creation for schema generation
    • getOverridesForSuppressingSchemaGeneration

      public Map<String,Object> getOverridesForSuppressingSchemaGeneration()
      Specified by:
      getOverridesForSuppressingSchemaGeneration in interface SchemaGenerationProcessor
      Returns:
      overrides that will be supplied to EMF creation for suppressing schema generation
    • isContainerDDLExecutionRequired

      public boolean isContainerDDLExecutionRequired()
      Specified by:
      isContainerDDLExecutionRequired in interface SchemaGenerationProcessor
      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 interface SchemaGenerationProcessor
    • 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.