Class EntityManagerSetupImpl

  • All Implemented Interfaces:
    org.eclipse.persistence.sessions.coordination.MetadataRefreshListener

    public class EntityManagerSetupImpl
    extends java.lang.Object
    implements org.eclipse.persistence.sessions.coordination.MetadataRefreshListener
    INTERNAL: This class handles deployment of a persistence unit. In predeploy the meta-data is processed and weaver transformer is returned to allow weaving of the persistent classes. In deploy the project and session are initialize and registered.
    • Field Detail

      • persistenceUnitUniqueName

        protected java.lang.String persistenceUnitUniqueName
      • sessionName

        protected java.lang.String sessionName
      • weaver

        protected PersistenceWeaver weaver
        Holds a reference to the weaver class transformer so it can be cleared after login.
      • persistenceUnitInfo

        protected javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo
      • factoryCount

        protected int factoryCount
      • session

        protected org.eclipse.persistence.internal.sessions.AbstractSession session
      • isInContainerMode

        protected boolean isInContainerMode
      • isSessionLoadedFromSessionsXML

        protected boolean isSessionLoadedFromSessionsXML
      • projectCacheAccessor

        protected ProjectCache projectCacheAccessor
      • shouldBuildProject

        protected boolean shouldBuildProject
      • enableWeaving

        protected java.lang.Boolean enableWeaving
      • isWeavingStatic

        protected boolean isWeavingStatic
      • securableObjectHolder

        protected org.eclipse.persistence.internal.security.SecurableObjectHolder securableObjectHolder
      • deployLock

        protected org.eclipse.persistence.internal.helper.ConcurrencyManager deployLock
      • requiresConnection

        protected boolean requiresConnection
      • structConverters

        protected java.util.List<org.eclipse.persistence.platform.database.converters.StructConverter> structConverters
      • STATE_PREDEPLOYED

        public static final java.lang.String STATE_PREDEPLOYED
        See Also:
        Constant Field Values
      • STATE_HALF_DEPLOYED

        public static final java.lang.String STATE_HALF_DEPLOYED
        See Also:
        Constant Field Values
      • STATE_PREDEPLOY_FAILED

        public static final java.lang.String STATE_PREDEPLOY_FAILED
        See Also:
        Constant Field Values
      • STATE_DEPLOY_FAILED

        public static final java.lang.String STATE_DEPLOY_FAILED
        See Also:
        Constant Field Values
      • STATE_UNDEPLOYED

        public static final java.lang.String STATE_UNDEPLOYED
        See Also:
        Constant Field Values
      • STATE_HALF_PREDEPLOYED_COMPOSITE_MEMBER

        public static final java.lang.String STATE_HALF_PREDEPLOYED_COMPOSITE_MEMBER
        See Also:
        Constant Field Values
      • state

        protected java.lang.String state
        Initial -----> HalfPredeployedCompositeMember -----> PredeployFailed | ^ | V------->| V Predeployed
      • ERROR_LOADING_XML_FILE

        public static final java.lang.String ERROR_LOADING_XML_FILE
        Initial -----------> PredeployFailed --- | | V | Predeployed ---> DeployFailed -- | | | | V V V HalfDeployed --> Deployed -> Undeployed | ^ V | DeployFailed -------------------
        See Also:
        Constant Field Values
      • EXCEPTION_LOADING_ENTITY_CLASS

        public static final java.lang.String EXCEPTION_LOADING_ENTITY_CLASS
        See Also:
        Constant Field Values
      • connectionPropertyNames

        public static java.lang.String[] connectionPropertyNames
      • isMetadataExpired

        protected boolean isMetadataExpired
        Used to indicate that an EntityManagerFactoryImpl based on this EntityManagerSetupImpl has been refreshed. This means this EntityManagerSetupImpl will no longer be associated with new EntityManagerFactories
      • persistenceException

        protected javax.persistence.PersistenceException persistenceException
    • Constructor Detail

      • EntityManagerSetupImpl

        public EntityManagerSetupImpl​(java.lang.String persistenceUnitUniqueName,
                                      java.lang.String sessionName)
      • EntityManagerSetupImpl

        public EntityManagerSetupImpl()
    • Method Detail

      • addFileSeperator

        protected static java.lang.String addFileSeperator​(java.lang.String appLocation)
      • getOrBuildSessionName

        public static java.lang.String getOrBuildSessionName​(java.util.Map properties,
                                                             javax.persistence.spi.PersistenceUnitInfo puInfo,
                                                             java.lang.String persistenceUnitUniqueName)
      • buildSessionNameSuffixFromConnectionProperties

        protected static java.lang.String buildSessionNameSuffixFromConnectionProperties​(java.util.Map properties)
      • changeSessionName

        public void changeSessionName​(java.lang.String newSessionName)
      • removeSessionFromGlobalSessionManager

        protected void removeSessionFromGlobalSessionManager()
        This method can be used to ensure the session represented by emSetupImpl is removed from the SessionManager.
      • deploy

        public org.eclipse.persistence.internal.sessions.AbstractSession deploy​(java.lang.ClassLoader realClassLoader,
                                                                                java.util.Map additionalProperties)
        Deploy a persistence session and return an EntityManagerFactory. Deployment takes a session that was partially created in the predeploy call and makes it whole. This means doing any configuration that requires the real class definitions for the entities. In the predeploy phase we were in a stage where we were not let allowed to load the real classes. Deploy could be called several times - but only the first call does the actual deploying - additional calls allow to update session properties (in case the session is not connected). Note that there is no need to synchronize deploy method - it doesn't alter factoryCount and while deploy is executed no other method can alter the current state (predeploy call would just increment factoryCount; undeploy call would not drop factoryCount to 0). However precautions should be taken to handle concurrent calls to deploy, because those may alter the current state or connect the session.
        Parameters:
        realClassLoader - The class loader that was used to load the entity classes. This loader will be maintained for the lifespan of the loaded classes.
        additionalProperties - added to persistence unit properties for updateServerSession overriding existing properties. In JSE case it allows to alter properties in main (as opposed to preMain where preDeploy is called).
        Returns:
        An EntityManagerFactory to be used by the Container to obtain EntityManagers
      • createDeployFailedPersistenceException

        protected javax.persistence.PersistenceException createDeployFailedPersistenceException​(java.lang.Throwable ex)
      • addProjectToSession

        protected void addProjectToSession​(org.eclipse.persistence.sessions.server.ServerSession session,
                                           org.eclipse.persistence.sessions.Project project)
        Adds descriptors plus sequencing info found on the project to the session.
      • addSessionToGlobalSessionManager

        protected void addSessionToGlobalSessionManager()
        Put the given session into the session manager so it can be looked up later
      • addStructConverters

        public void addStructConverters()
        Add the StructConverters that were specified by annotation on the DatabasePlatform This method must be called after the DatabasePlatform has been detected
      • assignCMP3Policy

        protected void assignCMP3Policy()
        Assign a CMP3Policy to each descriptor, and sets the OptimisticLockingPolicy's LockOnChangeMode if applicable.
      • updateServerPlatform

        protected boolean updateServerPlatform​(java.util.Map m,
                                               java.lang.ClassLoader loader)
        Updates the EclipseLink ServerPlatform class for use with this platform.
        Returns:
        true if the ServerPlatform has changed.
      • updatePartitioning

        protected void updatePartitioning​(java.util.Map m,
                                          java.lang.ClassLoader loader)
        Checks for partitioning properties.
      • updateRemote

        protected void updateRemote​(java.util.Map m,
                                    java.lang.ClassLoader loader)
        Checks for partitioning properties.
      • updateDatabaseEventListener

        protected void updateDatabaseEventListener​(java.util.Map m,
                                                   java.lang.ClassLoader loader)
        Checks for database events listener properties.
      • updateLoggers

        protected void updateLoggers​(java.util.Map persistenceProperties,
                                     boolean serverPlatformChanged,
                                     java.lang.ClassLoader loader)
        Update loggers and settings for the singleton logger and the session logger.
        Parameters:
        persistenceProperties - the properties map
        serverPlatformChanged - the boolean that denotes a serverPlatform change in the session.
      • updateProfiler

        protected void updateProfiler​(java.util.Map persistenceProperties,
                                      java.lang.ClassLoader loader)
        Check for the PROFILER persistence or system property and set the Session's profiler. This can also set the QueryMonitor.
      • findClass

        protected static java.lang.Class findClass​(java.lang.String className,
                                                   java.lang.ClassLoader loader)
                                            throws java.lang.ClassNotFoundException,
                                                   java.security.PrivilegedActionException
        Throws:
        java.lang.ClassNotFoundException
        java.security.PrivilegedActionException
      • findClassForProperty

        protected static java.lang.Class findClassForProperty​(java.lang.String className,
                                                              java.lang.String propertyName,
                                                              java.lang.ClassLoader loader)
      • getStructConverters

        protected java.util.List<org.eclipse.persistence.platform.database.converters.StructConverter> getStructConverters​(java.lang.ClassLoader realClassLoader)
        Internal: Returns a list of StructConverter instances from a list of StructConverter names stored within the project.
        Parameters:
        realClassLoader -
        Returns:
      • hasSchemaDatabaseGeneration

        protected boolean hasSchemaDatabaseGeneration​(java.util.Map m)
      • hasSchemaScriptsGeneration

        protected boolean hasSchemaScriptsGeneration​(java.util.Map m)
      • getSession

        public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
      • getDatabaseSession

        public org.eclipse.persistence.internal.sessions.DatabaseSessionImpl getDatabaseSession()
      • getDatabaseSession

        public org.eclipse.persistence.internal.sessions.DatabaseSessionImpl getDatabaseSession​(java.util.Map props)
        We may be provided a connection via the properties to use. Check for one and build a database session around it. Otherwise return the pu database session.
      • buildObjectForClass

        protected static java.lang.Object buildObjectForClass​(java.lang.Class clazz,
                                                              java.lang.Class mustBeImplementedInterface)
                                                       throws java.lang.IllegalAccessException,
                                                              java.security.PrivilegedActionException,
                                                              java.lang.InstantiationException
        This method will be used to validate the specified class and return it's instance.
        Throws:
        java.lang.IllegalAccessException
        java.security.PrivilegedActionException
        java.lang.InstantiationException
      • updateDescriptorCacheSettings

        protected void updateDescriptorCacheSettings​(java.util.Map m,
                                                     java.lang.ClassLoader loader)
      • updateConnectionSettings

        protected void updateConnectionSettings​(org.eclipse.persistence.sessions.server.ServerSession serverSession,
                                                java.util.Map properties)
        Process all properties under "eclipselink.connection-pool.". This allows for named connection pools. It also processes "read", "write", "default" and "sequence" connection pools.
      • updateConnectionPolicy

        protected void updateConnectionPolicy​(org.eclipse.persistence.sessions.server.ServerSession serverSession,
                                              java.util.Map m)
      • getConnectionPolicyExclusiveModeFromProperties

        public static org.eclipse.persistence.sessions.server.ConnectionPolicy.ExclusiveMode getConnectionPolicyExclusiveModeFromProperties​(java.util.Map m,
                                                                                                                                            org.eclipse.persistence.internal.sessions.AbstractSession abstractSession,
                                                                                                                                            boolean useSystemAsDefault)
      • predeploy

        public javax.persistence.spi.ClassTransformer predeploy​(javax.persistence.spi.PersistenceUnitInfo info,
                                                                java.util.Map extendedProperties)
        Perform any steps necessary prior to actual deployment. This includes any steps in the session creation that do not require the real loaded domain classes. The first call to this method caches persistenceUnitInfo which is reused in the following calls. Note that in JSE case factoryCount is NOT incremented on the very first call (by JavaSECMPInitializer.callPredeploy, typically in preMain). That provides 1 to 1 correspondence between factoryCount and the number of open factories. In case factoryCount > 0 the method just increments factoryCount. factory == 0 triggers creation of a new session. This method and undeploy - the only methods altering factoryCount - should be synchronized.
        Returns:
        A transformer (which may be null) that should be plugged into the proper classloader to allow classes to be transformed as they get loaded.
        See Also:
        deploy(ClassLoader, Map)
      • createPredeployFailedPersistenceException

        protected javax.persistence.PersistenceException createPredeployFailedPersistenceException​(java.lang.Throwable ex)
      • getDeployedSessionName

        public java.lang.String getDeployedSessionName()
        Return the name of the session this SetupImpl is building. The session name is only known at deploy time and if this method is called prior to that, this method will return null.
      • getPersistenceUnitInfo

        public javax.persistence.spi.PersistenceUnitInfo getPersistenceUnitInfo()
      • isValidationOnly

        public boolean isValidationOnly​(java.util.Map m)
      • isValidationOnly

        protected boolean isValidationOnly​(java.util.Map m,
                                           boolean shouldMergeMap)
      • shouldGetSessionOnCreateFactory

        public boolean shouldGetSessionOnCreateFactory​(java.util.Map m)
        Return if the session should be deployed and connected during the creation of the EntityManagerFactory, or if it should be deferred until createEntityManager(). The default is to defer, but is only validating, or can be configured to deploy upfront to avoid hanging the application at runtime.
      • mergeWithExistingMap

        protected java.util.Map mergeWithExistingMap​(java.util.Map m)
      • isInContainerMode

        public boolean isInContainerMode()
      • updateCacheCoordination

        protected void updateCacheCoordination​(java.util.Map m,
                                               java.lang.ClassLoader loader)
        Configure cache coordination using properties.
      • updateSerializer

        protected void updateSerializer​(java.util.Map m,
                                        java.lang.ClassLoader loader)
        Update session serializer.
      • updateShouldOptimizeResultSetAccess

        protected void updateShouldOptimizeResultSetAccess​(java.util.Map m)
        Update whether session ShouldOptimizeResultSetAccess.
      • updateTenancy

        protected void updateTenancy​(java.util.Map m,
                                     java.lang.ClassLoader loader)
        Update whether session should use externally defined multi tenancy.
      • updateTolerateInvalidJPQL

        protected void updateTolerateInvalidJPQL​(java.util.Map m)
        Update whether session should tolerate invalid JPQL at creation time.
      • updateLogins

        protected void updateLogins​(java.util.Map m)
        Override the default login creation method. If persistenceInfo is available, use the information from it to setup the login and possibly to set readConnectionPool.
      • getDatasourceFromProperties

        protected javax.sql.DataSource getDatasourceFromProperties​(java.util.Map m,
                                                                   java.lang.String property,
                                                                   javax.sql.DataSource defaultDataSource)
        This is used to return either the defaultDatasource or, if one exists, a datasource defined under the property from the Map m. This method will build a DataSourceImpl object to hold the url if the property in Map m defines a string instead of a datasource.
      • updateLoginDefaultConnector

        protected void updateLoginDefaultConnector​(org.eclipse.persistence.sessions.DatasourceLogin login,
                                                   java.util.Map m)
        In cases where there is no data source, we will use properties to configure the login for our session. This method gets those properties and sets them on the login.
      • updatePools

        protected void updatePools​(org.eclipse.persistence.sessions.server.ServerSession serverSession,
                                   java.util.Map m)
        Configure the internal connection pooling parameters. By default if nothing is configured a default shared (exclusive) read/write pool is used with 32 min/max connections and 1 initial.
      • initSession

        protected void initSession()
        Normally when a property is missing nothing should be applied to the session. However there are several session attributes that defaulted in EJB3 to the values different from EclipseLink defaults. This function applies defaults for such properties and registers the session. All other session-related properties are applied in updateServerSession. Note that updateSession may be called several times on the same session (before login), but initSession is called just once - before the first call to updateSession.
      • updateSession

        protected void updateSession​(java.util.Map m,
                                     java.lang.ClassLoader loader)
        Make any changes to our ServerSession that can be made after it is created.
      • setIsInContainerMode

        public void setIsInContainerMode​(boolean isInContainerMode)
        This sets the isInContainerMode flag. "true" indicates container case, "false" - SE.
      • setIsMetadataExpired

        public void setIsMetadataExpired​(boolean hasExpiredMetadata)
        Used to indicate that an EntityManagerFactoryImpl based on this EntityManagerSetupImpl has been refreshed. This means this EntityManagerSetupImpl will no longer be associated with new EntityManagerFactories
      • processSessionCustomizer

        protected void processSessionCustomizer​(java.util.Map m,
                                                java.lang.ClassLoader loader)
      • initOrUpdateLogging

        protected void initOrUpdateLogging​(java.util.Map m,
                                           org.eclipse.persistence.logging.SessionLog log)
      • processDescriptorCustomizers

        protected void processDescriptorCustomizers​(java.util.Map m,
                                                    java.lang.ClassLoader loader)
      • isInitial

        public boolean isInitial()
      • isMetadataExpired

        public boolean isMetadataExpired()
        Used to indicate that an EntityManagerFactoryImpl based on this EntityManagerSetupImpl has been refreshed. This means this EntityManagerSetupImpl will no longer be associated with new EntityManagerFactories
      • isPredeployed

        public boolean isPredeployed()
      • isDeployed

        public boolean isDeployed()
      • isHalfDeployed

        public boolean isHalfDeployed()
      • isUndeployed

        public boolean isUndeployed()
      • isPredeployFailed

        public boolean isPredeployFailed()
      • isDeployFailed

        public boolean isDeployFailed()
      • isHalfPredeployedCompositeMember

        public boolean isHalfPredeployedCompositeMember()
      • getPersistenceUnitUniqueName

        public java.lang.String getPersistenceUnitUniqueName()
      • getFactoryCount

        public int getFactoryCount()
      • getSessionName

        public java.lang.String getSessionName()
      • shouldRedeploy

        public boolean shouldRedeploy()
      • shouldSendMetadataRefreshCommand

        public boolean shouldSendMetadataRefreshCommand​(java.util.Map m)
        Return if MetadataSource refresh commands should be sent when refresh is called Checks the PersistenceUnitProperties.METADATA_SOURCE_RCM_COMMAND property and defaults to true.
      • undeploy

        public void undeploy()
        Undeploy may be called several times, but only the call that decreases factoryCount to 0 disconnects the session and removes it from the session manager. This method and predeploy - the only methods altering factoryCount - should be synchronized. After undeploy call that turns factoryCount to 0: session==null; PREDEPLOYED, DEPLOYED and DEPLOYED_FAILED states change to UNDEPLOYED state.
      • setRequiresConnection

        public void setRequiresConnection​(boolean requiresConnection)
        INTERNAL: By default we require a connection to the database. However, when generating schema to scripts only, this is not required.
      • setSessionEventListener

        protected void setSessionEventListener​(java.util.Map m,
                                               java.lang.ClassLoader loader)
        Allow customized session event listener to be added into session. The method needs to be called in deploy stage.
      • setExceptionHandler

        protected void setExceptionHandler​(java.util.Map m,
                                           java.lang.ClassLoader loader)
        Allow customized exception handler to be added into session. The method needs to be called in deploy and pre-deploy stage.
      • updateBatchWritingSetting

        protected void updateBatchWritingSetting​(java.util.Map persistenceProperties,
                                                 java.lang.ClassLoader loader)
        Update batch writing setting. The method needs to be called in deploy stage.
      • updateMetadataRepository

        protected void updateMetadataRepository​(java.util.Map m,
                                                java.lang.ClassLoader loader)
        Load the Metadata Repository for Extensibility
      • updateTunerPreDeploy

        protected void updateTunerPreDeploy​(java.util.Map m,
                                            java.lang.ClassLoader loader)
        Check for a tuning property and run the tuner preDeploy.
      • updateTunerDeploy

        protected void updateTunerDeploy​(java.util.Map m,
                                         java.lang.ClassLoader loader)
        Check for a tuning property and run the tuner deploy.
      • updateTunerPostDeploy

        protected void updateTunerPostDeploy​(java.util.Map m,
                                             java.lang.ClassLoader loader)
        Check for a tuning property and run the tuner deploy.
      • updateFreeMemory

        protected void updateFreeMemory​(java.util.Map m)
        Allow the deployment metadata to be freed post-deploy to conserve memory.
      • updateNativeSQLSetting

        protected void updateNativeSQLSetting​(java.util.Map m)
        Enable or disable the capability of Native SQL function. The method needs to be called in deploy stage.
      • updateSequencing

        protected void updateSequencing​(java.util.Map m)
        Configure sequencing settings.
      • updateSequencingStart

        protected void updateSequencingStart​(java.util.Map m)
      • updateProjectCache

        protected void updateProjectCache​(java.util.Map m,
                                          java.lang.ClassLoader loader)
        Load the projectCacheAccessor for JPA project caching
      • updateJPQLParser

        protected void updateJPQLParser​(java.util.Map m)
        Enable or disable the capability of Native SQL function. The method needs to be called in deploy stage.
      • updateAllowNativeSQLQueriesSetting

        protected void updateAllowNativeSQLQueriesSetting​(java.util.Map m)
        Enable or disable the capability of Native SQL function. The method needs to be called in deploy stage.
      • updateSQLCastSetting

        protected void updateSQLCastSetting​(java.util.Map m)
        Enable or disable SQL casting.
      • updateUppercaseSetting

        protected void updateUppercaseSetting​(java.util.Map m)
        Enable or disable forcing field names to uppercase. The method needs to be called in deploy stage.
      • updateCaseSensitivitySettings

        public static void updateCaseSensitivitySettings​(java.util.Map m,
                                                         MetadataProject project,
                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
        /** Enable or disable forcing field names to be case insensitive. Implementation of case insensitive column handling relies on setting both sides to uppercase (the column names from annotations/xml as well as what is returned from the JDBC/statement) The method needs to be called in deploy stage.
      • updatePessimisticLockTimeout

        protected void updatePessimisticLockTimeout​(java.util.Map persistenceProperties)
        Update the default pessimistic lock timeout value.
        Parameters:
        persistenceProperties - the properties map
      • updatePessimisticLockTimeoutUnit

        protected void updatePessimisticLockTimeoutUnit​(java.util.Map persistenceProperties)
        Update the default pessimistic lock timeout unit value.
        Parameters:
        persistenceProperties - the properties map
      • updateCacheStatementSettings

        protected void updateCacheStatementSettings​(java.util.Map m)
        Enable or disable statements cached, update statements cache size. The method needs to be called in deploy stage.
      • updateAllowZeroIdSetting

        protected void updateAllowZeroIdSetting​(java.util.Map m)
        Enable or disable default allowing 0 as an id.
      • updateAllowNULLMAXMINSetting

        protected void updateAllowNULLMAXMINSetting​(java.util.Map m)
        Enable or disable default allowing null return from MAX or MIN
      • updateAllowConvertResultToBoolean

        protected void updateAllowConvertResultToBoolean​(java.util.Map m)
        Enable or disable default allowing conversion of ResultSet values type to boolean type
      • updateIdValidation

        protected void updateIdValidation​(java.util.Map m)
        Enable or disable default allowing 0 as an id.
      • updateSharedCacheMode

        protected void updateSharedCacheMode​(java.util.Map m)
        Sets the SharedCacheMode with values from the javax.persistence.sharedCache.mode property. If user enters an invalid caching type, valueOf will throw an illegal argument exception, e.g. java.lang.IllegalArgumentException: No enum const class javax.persistence.SharedCacheMode.ALLBOGUS
      • updateTableCreationSettings

        protected void updateTableCreationSettings​(java.util.Map m)
        sets the TABLE_CREATION_SUFFIX property on the session's project to be applied to all table creation statements (DDL)
      • updateIndexForeignKeys

        protected void updateIndexForeignKeys​(java.util.Map m)
        Sets shouldCreateIndicesOnForeignKeys DDL generation option.
      • updateTemporalMutableSetting

        protected void updateTemporalMutableSetting​(java.util.Map m)
        Enable or disable default temporal mutable setting. The method needs to be called in deploy stage.
      • setDescriptorNamedQueries

        protected void setDescriptorNamedQueries​(java.util.Map m)
        Copy named queries defined in EclipseLink descriptor into the session if it was indicated to do so.
      • updateAllowExtendedCacheLogging

        protected void updateAllowExtendedCacheLogging​(java.util.Map m)
        Enable or disable extended logging of JPA L2 cache usage. The method needs to be called in deploy stage.
      • updateAllowExtendedThreadLogging

        protected void updateAllowExtendedThreadLogging​(java.util.Map m)
        Enable or disable extended thread logging. The method needs to be called in deploy stage.
      • updateAllowExtendedThreadLoggingThreadDump

        protected void updateAllowExtendedThreadLoggingThreadDump​(java.util.Map m)
        Enable or disable thread dump addition to extended thread logging. The method needs to be called in deploy stage.
      • updateAllowQueryResultsCacheValidation

        protected void updateAllowQueryResultsCacheValidation​(java.util.Map m)
        Enable or disable query result cache validation. The method needs to be called in deploy stage.
      • getMetamodel

        public javax.persistence.metamodel.Metamodel getMetamodel​(java.lang.ClassLoader classLoader)
        INTERNAL: Return an instance of Metamodel interface for access to the metamodel of the persistence unit. This method will complete any initialization done in the predeploy phase of deployment.
        Returns:
        Metamodel instance
        Since:
        Java Persistence 2.0
      • initializeCanonicalMetamodel

        protected void initializeCanonicalMetamodel​(javax.persistence.metamodel.Metamodel model)
        INTERNAL: Initialize the Canonical Metamodel classes generated by EclipseLink
        Since:
        Java Persistence 2.0
      • setMetamodel

        public void setMetamodel​(javax.persistence.metamodel.Metamodel aMetamodel)
        INTERNAL: Convenience function to allow us to reset the Metamodel in the possible case that we want to regenerate it. This function is outside of the JPA 2.0 specification.
        Parameters:
        aMetamodel -
        Since:
        Java Persistence 2.0
      • mustBeCompositeMember

        public boolean mustBeCompositeMember()
      • isCompositeMember

        public boolean isCompositeMember()
      • isComposite

        public boolean isComposite()
      • mustBeCompositeMember

        public static boolean mustBeCompositeMember​(javax.persistence.spi.PersistenceUnitInfo puInfo)
      • isComposite

        public static boolean isComposite​(javax.persistence.spi.PersistenceUnitInfo puInfo)
      • setCompositeEmSetupImpl

        public void setCompositeEmSetupImpl​(EntityManagerSetupImpl compositeEmSetupImpl)
      • setStaticWeaveInfo

        public void setStaticWeaveInfo​(StaticWeaveInfo staticWeaveInfo)
      • predeployCompositeMembers

        protected void predeployCompositeMembers​(java.util.Map predeployProperties,
                                                 java.lang.ClassLoader tempClassLoader)
      • deployCompositeMembers

        protected void deployCompositeMembers​(java.util.Map deployProperties,
                                              java.lang.ClassLoader realClassLoader)
      • preInitializeMetamodel

        public void preInitializeMetamodel()
        INTERNAL: Cause the first phase of metamodel initialization. This phase involves detecting the classes involved and build metamodel instances for them.
      • preInitializeCanonicalMetamodel

        public void preInitializeCanonicalMetamodel​(EntityManagerFactoryImpl factory)
        INTERNAL: First phase of canonical metamodel initialization. For each class the metamodel is aware of, check for a canonical metamodel class and initialize each attribute in it with a proxy that can cause the rest of the metamodel population. Attributes are found reflectively rather than through the metamodel to avoid having to further initialize the metamodel.
        Parameters:
        factory -
      • updateCompositeMembersProperties

        protected void updateCompositeMembersProperties​(java.util.Map compositeProperties)
      • updateCompositeMembersProperties

        protected void updateCompositeMembersProperties​(java.util.Set<SEPersistenceUnitInfo> compositePuInfos,
                                                        java.util.Map compositeProperties)
      • overrideMemberProperties

        protected static void overrideMemberProperties​(java.util.Map memberProperties,
                                                       java.util.Map compositeProperties)
      • getCompositeMemberPuInfoMap

        protected static java.util.Map<java.lang.String,​SEPersistenceUnitInfo> getCompositeMemberPuInfoMap​(javax.persistence.spi.PersistenceUnitInfo puInfo,
                                                                                                                 java.util.Map predeployProperties)
      • getCompositeMemberPuInfoSet

        protected static java.util.Set<SEPersistenceUnitInfo> getCompositeMemberPuInfoSet​(javax.persistence.spi.PersistenceUnitInfo puInfo,
                                                                                          java.util.Map predeployProperties)
      • throwPersistenceUnitNameAlreadyInUseException

        public static void throwPersistenceUnitNameAlreadyInUseException​(java.lang.String puName,
                                                                         javax.persistence.spi.PersistenceUnitInfo newPuInfo,
                                                                         javax.persistence.spi.PersistenceUnitInfo exsitingPuInfo)
      • refreshMetadata

        public EntityManagerSetupImpl refreshMetadata​(java.util.Map properties)
        Create a new version of this EntityManagerSetupImpl and cache it. Prepare "this" EntityManagerSetupImpl for garbage collection. This call will mean any users of this EntityManagerSetupImpl will get the new version the next time they look it up (for instance and EntityManager creation time)
        Parameters:
        properties -
        Returns:
      • triggerMetadataRefresh

        public void triggerMetadataRefresh​(java.util.Map properties)
        This method is just a wrapper on refreshMetadata so that core does not need a dependency on JPA due to the EntityManagerSetupImpl return value. This method satisfies the MetedataRefreshListener implementation and is called by incoming RCM refresh commands
        Specified by:
        triggerMetadataRefresh in interface org.eclipse.persistence.sessions.coordination.MetadataRefreshListener
        See Also:
        refreshMetadata(java.util.Map)
      • writeDDL

        public void writeDDL​(java.util.Map props,
                             org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                             java.lang.ClassLoader classLoader)
        INTERNAL: Generate the DDL per the properties specified.
      • writeDDL

        protected void writeDDL​(java.lang.String ddlGeneration,
                                java.util.Map props,
                                org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                java.lang.ClassLoader classLoader)
        INTERNAL: Generate the DDL from the persistence unit metadata. This DDL generation utilizes the EclipseLink DDL properties.
      • writeDDL

        protected void writeDDL​(java.lang.String generationSourceProperty,
                                java.lang.String scriptGenerationSourceProperty,
                                EntityManagerSetupImpl.TableCreationType tableCreationType,
                                java.util.Map props,
                                org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                java.lang.ClassLoader loader)
        INTERNAL: Generate the DDL per the properties given.
      • writeDDLToDatabase

        protected void writeDDLToDatabase​(org.eclipse.persistence.tools.schemaframework.SchemaManager mgr,
                                          EntityManagerSetupImpl.TableCreationType ddlType)
        INTERNAL: Generate and write DDL from the persistence unit metadata to the database.
      • writeDDLToFiles

        protected void writeDDLToFiles​(org.eclipse.persistence.tools.schemaframework.SchemaManager mgr,
                                       java.lang.String appLocation,
                                       java.lang.Object createDDLJdbc,
                                       java.lang.Object dropDDLJdbc,
                                       EntityManagerSetupImpl.TableCreationType ddlType,
                                       java.util.Map props)
        Write the DDL to the files provided.
      • writeMetadataDDLToDatabase

        protected void writeMetadataDDLToDatabase​(EntityManagerSetupImpl.TableCreationType tableCreationType,
                                                  java.util.Map props,
                                                  org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                                  java.lang.ClassLoader classLoader)
        INTERNAL: Generate and write DDL from the persistence unit metadata to the database.
      • writeMetadataDDLToScript

        protected void writeMetadataDDLToScript​(EntityManagerSetupImpl.TableCreationType tableCreationType,
                                                java.util.Map props,
                                                org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                                java.lang.ClassLoader classLoader)
        INTERNAL: Generate and write DDL from the persistence unit metadata to scripts.
      • writeSourceScriptToDatabase

        protected void writeSourceScriptToDatabase​(java.lang.Object source,
                                                   org.eclipse.persistence.internal.sessions.DatabaseSessionImpl session,
                                                   java.lang.ClassLoader loader)
        This method will read SQL from a reader or URL and send it through to the database. This could open up the database to SQL injection if not careful.