Class CMPPolicy

    • Field Detail

      • forceUpdate

        protected Boolean forceUpdate
      • updateAllFields

        protected Boolean updateAllFields
      • pessimisticLockingPolicy

        protected PessimisticLockingPolicy pessimisticLockingPolicy
        Allow the bean to always be locked as it enters a new transaction.
      • mappedClass

        protected Class mappedClass
        Class originally mapped, before anything was generated.
      • modificationDeferralLevel

        protected int modificationDeferralLevel
        The object deferral level. This controls when objects changes will be sent to the Database.
      • UPDATE_MODIFICATIONS

        public static final int UPDATE_MODIFICATIONS
        defer updates
        See Also:
        Constant Field Values
      • ALL_MODIFICATIONS

        public static final int ALL_MODIFICATIONS
        defer all modifications, inserts and deletes included (default)
        See Also:
        Constant Field Values
      • nonDeferredCreateTime

        protected int nonDeferredCreateTime
        This setting will allow customers to control when Toplink will issue the insert SQL for CMP beans.
      • UNDEFINED

        public static final int UNDEFINED
        undefined if it is non-deferred issue sql at create
        See Also:
        Constant Field Values
      • AFTER_EJBCREATE

        public static final int AFTER_EJBCREATE
        issue SQL after ejbCreate but before ejbPostCreate
        See Also:
        Constant Field Values
      • AFTER_EJBPOSTCREATE

        public static final int AFTER_EJBPOSTCREATE
        issue SQL after ejbPostCreate
        See Also:
        Constant Field Values
    • Constructor Detail

      • CMPPolicy

        public CMPPolicy()
    • Method Detail

      • getNonDeferredCreateTime

        public int getNonDeferredCreateTime()
        ADVANCED: This setting is only available for CMP beans that are not being deferred. Using it will allow TopLink to determine if the INSERT SQL should be sent to the database before or after the postCreate call.
      • setDeferModificationsUntilCommit

        public void setDeferModificationsUntilCommit​(int deferralLevel)
        ADVANCED: This can be set to control when changes to objects are submitted to the database This is only applicable to TopLink's CMP implementation and not available within the core.
      • setMappedClass

        public void setMappedClass​(Class newMappedClass)
        PUBLIC: Define the mapped class. This is the class which was originally mapped in the MW
        Parameters:
        newMappedClass -
      • getMappedClass

        public Class getMappedClass()
        PUBLIC: Answer the mapped class. This is the class which was originally mapped in the MW
      • setNonDeferredCreateTime

        public void setNonDeferredCreateTime​(int createTime)
        ADVANCED: This setting is only available for CMP beans that are not being deferred. Using it will allow TopLink to determine if the INSERT SQL should be sent to the database before or after the postCreate call.
      • hasPessimisticLockingPolicy

        public boolean hasPessimisticLockingPolicy()
        PUBLIC: Return true if bean pessimistic locking is configured
      • getDeferModificationsUntilCommit

        public int getDeferModificationsUntilCommit()
        ADVANCED: This can be used to control when changes to objects are submitted to the database This is only applicable to TopLink's CMP implementation and not available within the core.
      • getForceUpdate

        public boolean getForceUpdate()
        ADVANCED: Return true if descriptor is set to always update all registered objects of this type
      • setForceUpdate

        public void setForceUpdate​(boolean shouldForceUpdate)
        ADVANCED: Configure whether TopLink should always update all registered objects of this type. NOTE: if set to true, then updateAllFields must also be set to true
        Parameters:
        shouldForceUpdate -
      • getUpdateAllFields

        public boolean getUpdateAllFields()
        ADVANCED: Return true if descriptor is set to update all fields for an object of this type when an update occurs.
      • setUpdateAllFields

        public void setUpdateAllFields​(boolean shouldUpdatAllFields)
        ADVANCED: Configure whether TopLink should update all fields for an object of this type when an update occurs.
        Parameters:
        shouldUpdatAllFields -
      • internalGetForceUpdate

        public Boolean internalGetForceUpdate()
        INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.
      • internalGetUpdateAllFields

        public Boolean internalGetUpdateAllFields()
        INTERNAL: return internal tri-state value so we can decide whether to inherit or not at init time.
      • internalSetForceUpdate

        public void internalSetForceUpdate​(Boolean newForceUpdateValue)
        INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.
      • internalSetUpdateAllFields

        public void internalSetUpdateAllFields​(Boolean newUpdateAllFieldsValue)
        INTERNAL: internal method to set the tri-state value. This is done in InheritancePolicy at init time.
      • getDescriptor

        public ClassDescriptor getDescriptor()
        INTERNAL:
        Returns:
        Returns the owningDescriptor.
      • setDescriptor

        public void setDescriptor​(ClassDescriptor owningDescriptor)
        INTERNAL:
        Parameters:
        owningDescriptor - The owningDescriptor to set.
      • isCMP3Policy

        public boolean isCMP3Policy()
        INTERNAL: Return if this policy is for CMP3.
      • convertClassNamesToClasses

        public void convertClassNamesToClasses​(ClassLoader classLoader)
        INTERNAL: Convert all the class-name-based settings in this object to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.
        Parameters:
        classLoader -
      • createPrimaryKeyInstanceFromId

        public Object createPrimaryKeyInstanceFromId​(Object key,
                                                     AbstractSession session)
        INTERNAL: Create an instance of the composite primary key class for the key object.
      • createPrimaryKeyInstanceFromPrimaryKeyValues

        public Object createPrimaryKeyInstanceFromPrimaryKeyValues​(AbstractSession session,
                                                                   int[] elementIndex,
                                                                   Object... keyElements)
        INTERNAL: Create an instance of the composite primary key class for the key object. Yes the elementIndex looks strange but this is just a simple way to get the index to be pass-by-reference
      • createPrimaryKeyInstance

        public Object createPrimaryKeyInstance​(Object object,
                                               AbstractSession session)
        INTERNAL: Create an instance of the Id class or value from the object.
      • getClassInstance

        public Object getClassInstance​(Class<?> cls)
        INTERNAL: Return a new instance of the class provided.
      • getPKClassInstance

        public Object getPKClassInstance()
        INTERNAL:
      • getPKClass

        public Class getPKClass()
        INTERNAL:
      • createPrimaryKeyFromId

        public Object createPrimaryKeyFromId​(Object key,
                                             AbstractSession session)
        INTERNAL: Use the key to create a EclipseLink primary key. If the key is simple (direct mapped) then just add it to a vector, otherwise must go through the inefficient process of copying the key into the bean and extracting the key from the bean.
      • createBeanUsingKey

        public Object createBeanUsingKey​(Object key,
                                         AbstractSession session)
        INTERNAL: Use the key to create a bean and initialize its primary key fields. Note: If is a compound PK then a primary key object is being used. This method should only be used for 'templates' when executing queries. The bean built will not be given an EntityContext and should not be used as an actual entity bean.
        Parameters:
        key - Object the primary key to use for initializing the bean's corresponding pk fields
        Returns:
        Object
      • isSingleKey

        protected boolean isSingleKey​(CMPPolicy.KeyElementAccessor[] pkElementArray)
        Check to see if there is a single key element. Iterate through the list of primary key elements and count only keys that are not part of the Multitenant identifier.
        Parameters:
        pkElementArray -
        Returns: