Class AbstractEntityPersister

    • Field Detail

      • VERSION_COLUMN_ALIAS

        public static final java.lang.String VERSION_COLUMN_ALIAS
        See Also:
        Constant Field Values
      • batchSize

        protected final int batchSize
      • rowIdName

        protected final java.lang.String rowIdName
      • insertCallable

        protected boolean[] insertCallable
      • updateCallable

        protected boolean[] updateCallable
      • deleteCallable

        protected boolean[] deleteCallable
      • customSQLInsert

        protected java.lang.String[] customSQLInsert
      • customSQLUpdate

        protected java.lang.String[] customSQLUpdate
      • customSQLDelete

        protected java.lang.String[] customSQLDelete
      • propertyMapping

        protected final BasicEntityPropertyMapping propertyMapping
        Warning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties. To ensure correct results, propertyMapping should only be used for the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
    • Method Detail

      • addDiscriminatorToInsert

        protected void addDiscriminatorToInsert​(Insert insert)
      • addDiscriminatorToSelect

        protected void addDiscriminatorToSelect​(SelectFragment select,
                                                java.lang.String name,
                                                java.lang.String suffix)
      • getSubclassColumnTableNumberClosure

        protected abstract int[] getSubclassColumnTableNumberClosure()
      • getSubclassFormulaTableNumberClosure

        protected abstract int[] getSubclassFormulaTableNumberClosure()
      • getSubclassTableName

        public abstract java.lang.String getSubclassTableName​(int j)
        Description copied from interface: Queryable
        Get the name of the table with the given index from the internal array.
        Specified by:
        getSubclassTableName in interface Queryable
        Parameters:
        j - The index into the internal array.
      • getSubclassTableKeyColumns

        protected abstract java.lang.String[] getSubclassTableKeyColumns​(int j)
      • isClassOrSuperclassTable

        protected abstract boolean isClassOrSuperclassTable​(int j)
      • isClassOrSuperclassJoin

        protected boolean isClassOrSuperclassJoin​(int j)
      • getSubclassTableSpan

        public abstract int getSubclassTableSpan()
      • getTableSpan

        public abstract int getTableSpan()
      • isTableCascadeDeleteEnabled

        public abstract boolean isTableCascadeDeleteEnabled​(int j)
      • getTableName

        public abstract java.lang.String getTableName​(int j)
      • getKeyColumns

        public abstract java.lang.String[] getKeyColumns​(int j)
      • isPropertyOfTable

        public abstract boolean isPropertyOfTable​(int property,
                                                  int j)
      • getPropertyTableNumbersInSelect

        protected abstract int[] getPropertyTableNumbersInSelect()
      • getPropertyTableNumbers

        protected abstract int[] getPropertyTableNumbers()
      • getSubclassPropertyTableNumber

        protected abstract int getSubclassPropertyTableNumber​(int i)
      • filterFragment

        protected abstract java.lang.String filterFragment​(java.lang.String alias,
                                                           java.util.Set<java.lang.String> treatAsDeclarations)
      • getDiscriminatorColumnName

        public java.lang.String getDiscriminatorColumnName()
        Specified by:
        getDiscriminatorColumnName in interface Loadable
        Returns:
        the column name for the discriminator as specified in the mapping.
      • getDiscriminatorColumnReaders

        public java.lang.String getDiscriminatorColumnReaders()
      • getDiscriminatorColumnReaderTemplate

        public java.lang.String getDiscriminatorColumnReaderTemplate()
      • getDiscriminatorAlias

        public java.lang.String getDiscriminatorAlias()
      • getDiscriminatorFormulaTemplate

        public java.lang.String getDiscriminatorFormulaTemplate()
      • isInverseTable

        public boolean isInverseTable​(int j)
      • isNullableTable

        public boolean isNullableTable​(int j)
      • isNullableSubclassTable

        protected boolean isNullableSubclassTable​(int j)
      • isInverseSubclassTable

        protected boolean isInverseSubclassTable​(int j)
      • isSubclassEntityName

        public boolean isSubclassEntityName​(java.lang.String entityName)
        Description copied from interface: EntityPersister
        Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.
        Specified by:
        isSubclassEntityName in interface EntityPersister
        Parameters:
        entityName - The entity name to be checked.
        Returns:
        True if the given entity name represents either the entity mapped by this persister or one of its subclass entities; false otherwise.
      • getSQLUpdateByRowIdStrings

        public java.lang.String[] getSQLUpdateByRowIdStrings()
      • getSQLLazyUpdateByRowIdStrings

        public java.lang.String[] getSQLLazyUpdateByRowIdStrings()
      • getSQLSnapshotSelectString

        public java.lang.String getSQLSnapshotSelectString()
      • getSQLLazySelectString

        public java.lang.String getSQLLazySelectString​(java.lang.String fetchGroup)
      • getSQLDeleteStrings

        public java.lang.String[] getSQLDeleteStrings()
      • getSQLInsertStrings

        public java.lang.String[] getSQLInsertStrings()
      • getSQLUpdateStrings

        public java.lang.String[] getSQLUpdateStrings()
      • getSQLLazyUpdateStrings

        public java.lang.String[] getSQLLazyUpdateStrings()
      • getSQLIdentityInsertString

        public java.lang.String getSQLIdentityInsertString()
        The query that inserts a row, letting the database generate an id
        Returns:
        The IDENTITY-based insertion query.
      • getVersionSelectString

        public java.lang.String getVersionSelectString()
      • isInsertCallable

        public boolean isInsertCallable​(int j)
      • isUpdateCallable

        public boolean isUpdateCallable​(int j)
      • isDeleteCallable

        public boolean isDeleteCallable​(int j)
      • isSubclassPropertyDeferred

        protected boolean isSubclassPropertyDeferred​(java.lang.String propertyName,
                                                     java.lang.String entityName)
      • isSubclassTableSequentialSelect

        protected boolean isSubclassTableSequentialSelect​(int j)
      • hasSequentialSelect

        public boolean hasSequentialSelect()
      • getTableUpdateNeeded

        public boolean[] getTableUpdateNeeded​(int[] dirtyProperties,
                                              boolean hasDirtyCollection)
        Decide which tables need to be updated.

        The return here is an array of boolean values with each index corresponding to a given table in the scope of this persister.

        Parameters:
        dirtyProperties - The indices of all the entity properties considered dirty.
        hasDirtyCollection - Whether any collections owned by the entity which were considered dirty.
        Returns:
        Array of booleans indicating which table require updating.
      • hasRowId

        public boolean hasRowId()
        Description copied from interface: Loadable
        Does the result set contain rowids?
        Specified by:
        hasRowId in interface Loadable
      • getPropertyColumnUpdateable

        public boolean[][] getPropertyColumnUpdateable()
      • getPropertyColumnInsertable

        public boolean[][] getPropertyColumnInsertable()
      • getPropertySelectable

        public boolean[] getPropertySelectable()
      • getTableNames

        public java.lang.String[] getTableNames()
      • getTemplateFromString

        protected static java.lang.String getTemplateFromString​(java.lang.String string,
                                                                SessionFactoryImplementor factory)
      • generateLazySelectStringsByFetchGroup

        protected java.util.Map<java.lang.String,​java.lang.String> generateLazySelectStringsByFetchGroup()
      • initializeLazyProperty

        public java.lang.Object initializeLazyProperty​(java.lang.String fieldName,
                                                       java.lang.Object entity,
                                                       SharedSessionContractImplementor session)
        Description copied from interface: LazyPropertyInitializer
        Initialize the property, and return its new value.
        Specified by:
        initializeLazyProperty in interface LazyPropertyInitializer
        Parameters:
        fieldName - The name of the field being initialized
        entity - The entity on which the initialization is occurring
        session - The session from which the initialization originated.
        Returns:
        ?
      • initializeLazyPropertiesFromDatastore

        protected java.lang.Object initializeLazyPropertiesFromDatastore​(java.lang.String fieldName,
                                                                         java.lang.Object entity,
                                                                         SharedSessionContractImplementor session,
                                                                         java.io.Serializable id,
                                                                         EntityEntry entry)
      • initializeLazyProperty

        protected boolean initializeLazyProperty​(java.lang.String fieldName,
                                                 java.lang.Object entity,
                                                 SharedSessionContractImplementor session,
                                                 EntityEntry entry,
                                                 int j,
                                                 java.lang.Object propValue)
      • isBatchable

        public boolean isBatchable()
      • getQuerySpaces

        public java.io.Serializable[] getQuerySpaces()
        Description copied from interface: EntityPersister
        Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.

        Much like EntityPersister.getPropertySpaces(), except that here we include subclass entity spaces.

        Specified by:
        getQuerySpaces in interface EntityPersister
        Returns:
        The query spaces.
      • getIdentifierColumnReaders

        public java.lang.String[] getIdentifierColumnReaders()
      • getIdentifierColumnReaderTemplates

        public java.lang.String[] getIdentifierColumnReaderTemplates()
      • getIdentifierColumnSpan

        public int getIdentifierColumnSpan()
      • getIdentifierAliases

        public java.lang.String[] getIdentifierAliases()
      • getVersionColumnName

        public java.lang.String getVersionColumnName()
        Description copied from interface: Lockable
        For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.
        Specified by:
        getVersionColumnName in interface Lockable
        Returns:
        The version column name.
      • getVersionedTableName

        public java.lang.String getVersionedTableName()
      • getSubclassColumnLazyiness

        protected boolean[] getSubclassColumnLazyiness()
      • getSubclassFormulaLazyiness

        protected boolean[] getSubclassFormulaLazyiness()
      • isCacheInvalidationRequired

        public boolean isCacheInvalidationRequired()
        We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database. This can happen if (a) the item is not versioned and either (b) we have dynamic update enabled or (c) we have multiple tables holding the state of the item.
        Specified by:
        isCacheInvalidationRequired in interface EntityPersister
      • getIdentifierAliases

        public java.lang.String[] getIdentifierAliases​(java.lang.String suffix)
        Description copied from interface: Loadable
        Get the result set aliases used for the identifier columns, given a suffix
        Specified by:
        getIdentifierAliases in interface Loadable
      • getPropertyAliases

        public java.lang.String[] getPropertyAliases​(java.lang.String suffix,
                                                     int i)
        Description copied from interface: Loadable
        Get the result set aliases used for the property columns, given a suffix (properties of this class, only).
        Specified by:
        getPropertyAliases in interface Loadable
      • getDiscriminatorAlias

        public java.lang.String getDiscriminatorAlias​(java.lang.String suffix)
        Description copied from interface: Loadable
        Get the result set aliases used for the identifier columns, given a suffix
        Specified by:
        getDiscriminatorAlias in interface Loadable
      • identifierSelectFragment

        public java.lang.String identifierSelectFragment​(java.lang.String name,
                                                         java.lang.String suffix)
        Description copied from interface: Queryable
        Given a query alias and an identifying suffix, render the identifier select fragment.
        Specified by:
        identifierSelectFragment in interface Queryable
      • propertySelectFragment

        public java.lang.String propertySelectFragment​(java.lang.String tableAlias,
                                                       java.lang.String suffix,
                                                       boolean allProperties)
        Description copied from interface: Queryable
        Given a query alias and an identifying suffix, render the property select fragment.
        Specified by:
        propertySelectFragment in interface Queryable
      • generateIdByUniqueKeySelectString

        public java.lang.String generateIdByUniqueKeySelectString​(java.lang.String uniquePropertyName)
      • generateSelectVersionString

        public java.lang.String generateSelectVersionString()
        Generate the SQL that selects the version number by id
      • getPropertyUniqueness

        public boolean[] getPropertyUniqueness()
      • generateInsertGeneratedValuesSelectString

        public java.lang.String generateInsertGeneratedValuesSelectString()
      • generateUpdateGeneratedValuesSelectString

        public java.lang.String generateUpdateGeneratedValuesSelectString()
      • concretePropertySelectFragment

        protected java.lang.String concretePropertySelectFragment​(java.lang.String alias,
                                                                  boolean[] includeProperty)
      • generateSnapshotSelectString

        public java.lang.String generateSnapshotSelectString()
      • getRootTableName

        public java.lang.String getRootTableName()
        Description copied from interface: Lockable
        Locks are always applied to the "root table".
        Specified by:
        getRootTableName in interface Lockable
        Returns:
        The root table name
      • getRootTableAlias

        public java.lang.String getRootTableAlias​(java.lang.String drivingAlias)
        Description copied from interface: Lockable
        Get the SQL alias this persister would use for the root table given the passed driving alias.
        Specified by:
        getRootTableAlias in interface Lockable
        Parameters:
        drivingAlias - The driving alias; or the alias for the table mapped by this persister in the hierarchy.
        Returns:
        The root table alias.
      • getRootTableIdentifierColumnNames

        public java.lang.String[] getRootTableIdentifierColumnNames()
        Description copied from interface: Lockable
        Get the names of columns on the root table used to persist the identifier.
        Specified by:
        getRootTableIdentifierColumnNames in interface Lockable
        Returns:
        The root table identifier column names.
      • toColumns

        public java.lang.String[] toColumns​(java.lang.String alias,
                                            java.lang.String propertyName)
                                     throws QueryException
        Obtain aliased column/formula fragments for the specified property path. Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
        Specified by:
        toColumns in interface PropertyMapping
        Throws:
        QueryException
      • toColumns

        public java.lang.String[] toColumns​(java.lang.String propertyName)
                                     throws QueryException
        Given a property path, return the corresponding column name(s). Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
        Specified by:
        toColumns in interface PropertyMapping
        Throws:
        QueryException
      • toType

        public Type toType​(java.lang.String propertyName)
                    throws QueryException
        Given a component path expression, get the type of the property Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
        Specified by:
        toType in interface PropertyMapping
        Throws:
        QueryException
      • getPropertyColumnNames

        public java.lang.String[] getPropertyColumnNames​(java.lang.String propertyName)
        Get the column names for the given property path Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
        Specified by:
        getPropertyColumnNames in interface OuterJoinLoadable
      • getSubclassPropertyTableNumber

        public int getSubclassPropertyTableNumber​(java.lang.String propertyPath)
        Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.
        Specified by:
        getSubclassPropertyTableNumber in interface Queryable
        Parameters:
        propertyPath - The name of the property.
        Returns:
        The number of the table to which the property is mapped.
      • getTypeDiscriminatorMetadata

        public DiscriminatorMetadata getTypeDiscriminatorMetadata()
        Description copied from interface: Queryable
        Retrieve the information needed to properly deal with this entity's discriminator in a query.
        Specified by:
        getTypeDiscriminatorMetadata in interface Queryable
        Returns:
        The entity discriminator metadata
      • generateTableAlias

        public static java.lang.String generateTableAlias​(java.lang.String rootAlias,
                                                          int tableNumber)
      • toColumns

        public java.lang.String[] toColumns​(java.lang.String name,
                                            int i)
        Description copied from interface: OuterJoinLoadable
        Given the number of a property of a subclass, and a table alias, return the aliased column names.
        Specified by:
        toColumns in interface OuterJoinLoadable
      • getPropertySubclassNames

        protected java.lang.String[] getPropertySubclassNames()
      • getPropertyColumnNames

        public java.lang.String[] getPropertyColumnNames​(int i)
        Description copied from interface: Loadable
        Get the result set column names mapped for this property (properties of this class, only).
        Specified by:
        getPropertyColumnNames in interface Loadable
      • getPropertyColumnWriters

        public java.lang.String[] getPropertyColumnWriters​(int i)
      • getPropertyColumnSpan

        public int getPropertyColumnSpan​(int i)
      • hasFormulaProperties

        public boolean hasFormulaProperties()
      • getSubclassPropertyColumnNames

        public java.lang.String[] getSubclassPropertyColumnNames​(int i)
        Description copied from interface: OuterJoinLoadable
        Return the column names used to persist the numbered property of the class or a subclass.
        Specified by:
        getSubclassPropertyColumnNames in interface OuterJoinLoadable
      • getSubclassPropertyTypeClosure

        protected Type[] getSubclassPropertyTypeClosure()
      • getSubclassPropertyColumnNameClosure

        protected java.lang.String[][] getSubclassPropertyColumnNameClosure()
      • getSubclassPropertyColumnReaderClosure

        public java.lang.String[][] getSubclassPropertyColumnReaderClosure()
      • getSubclassPropertyColumnReaderTemplateClosure

        public java.lang.String[][] getSubclassPropertyColumnReaderTemplateClosure()
      • getSubclassPropertyNameClosure

        protected java.lang.String[] getSubclassPropertyNameClosure()
      • resolveAttributeIndexes

        public int[] resolveAttributeIndexes​(java.lang.String[] attributeNames)
        Description copied from interface: EntityPersister
        Converts an array of attribute names to a set of indexes, according to the entity metamodel
        Specified by:
        resolveAttributeIndexes in interface EntityPersister
        Parameters:
        attributeNames - Array of names to be resolved
        Returns:
        A set of unique indexes of the attribute names found in the metamodel
      • getSubclassPropertySubclassNameClosure

        protected java.lang.String[] getSubclassPropertySubclassNameClosure()
      • getSubclassColumnClosure

        protected java.lang.String[] getSubclassColumnClosure()
      • getSubclassColumnAliasClosure

        protected java.lang.String[] getSubclassColumnAliasClosure()
      • getSubclassColumnReaderTemplateClosure

        public java.lang.String[] getSubclassColumnReaderTemplateClosure()
      • getSubclassFormulaClosure

        protected java.lang.String[] getSubclassFormulaClosure()
      • getSubclassFormulaTemplateClosure

        protected java.lang.String[] getSubclassFormulaTemplateClosure()
      • getSubclassFormulaAliasClosure

        protected java.lang.String[] getSubclassFormulaAliasClosure()
      • getSubclassPropertyColumnAliases

        public java.lang.String[] getSubclassPropertyColumnAliases​(java.lang.String propertyName,
                                                                   java.lang.String suffix)
        Description copied from interface: SQLLoadable
        Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).
        Specified by:
        getSubclassPropertyColumnAliases in interface SQLLoadable
      • getSubclassPropertyColumnNames

        public java.lang.String[] getSubclassPropertyColumnNames​(java.lang.String propertyName)
        Description copied from interface: SQLLoadable
        Return the column names used to persist/query the named property of the class or a subclass (optional operation).
        Specified by:
        getSubclassPropertyColumnNames in interface SQLLoadable
      • getLazyPropertyNumbers

        protected int[] getLazyPropertyNumbers()
      • getLazyPropertyNames

        protected java.lang.String[] getLazyPropertyNames()
      • getLazyPropertyTypes

        protected Type[] getLazyPropertyTypes()
      • getLazyPropertyColumnAliases

        protected java.lang.String[][] getLazyPropertyColumnAliases()
      • getPropertyIndex

        public int getPropertyIndex​(java.lang.String propertyName)
        Description copied from interface: UniqueKeyLoadable
        Get the property number of the unique key property
        Specified by:
        getPropertyIndex in interface UniqueKeyLoadable
      • getSQLWhereString

        protected java.lang.String getSQLWhereString​(java.lang.String alias)
      • hasWhere

        protected boolean hasWhere()
      • createEntityLoader

        protected UniqueEntityLoader createEntityLoader​(LockMode lockMode)
                                                 throws MappingException
        Used internally to create static loaders. These are the default set of loaders used to handle get()/load() processing. lock() handling is done by the LockingStrategy instances (see getLocker(org.hibernate.LockMode))
        Parameters:
        lockMode - The lock mode to apply to the thing being loaded.
        Returns:
        The UniqueEntityLoader.
        Throws:
        MappingException
      • check

        protected boolean check​(int rows,
                                java.io.Serializable id,
                                int tableNumber,
                                Expectation expectation,
                                java.sql.PreparedStatement statement,
                                java.lang.String statementSQL)
                         throws HibernateException
        Throws:
        HibernateException
      • generateUpdateString

        public java.lang.String generateUpdateString​(boolean[] includeProperty,
                                                     int j,
                                                     boolean useRowId)
      • generateUpdateString

        public java.lang.String generateUpdateString​(boolean[] includeProperty,
                                                     int j,
                                                     java.lang.Object[] oldFields,
                                                     boolean useRowId)
        Generate the SQL that updates a row by id (and version)
      • checkVersion

        public final boolean checkVersion​(boolean[] includeProperty)
      • generateInsertString

        public java.lang.String generateInsertString​(boolean[] includeProperty,
                                                     int j)
      • generateInsertString

        public java.lang.String generateInsertString​(boolean identityInsert,
                                                     boolean[] includeProperty)
      • generateInsertString

        public java.lang.String generateInsertString​(boolean identityInsert,
                                                     boolean[] includeProperty,
                                                     int j)
        Generate the SQL that inserts a row
      • generateIdentityInsertString

        public java.lang.String generateIdentityInsertString​(SqlStringGenerationContext context,
                                                             boolean[] includeProperty)
        Used to generate an insert statement against the root table in the case of identifier generation strategies where the insert statement executions actually generates the identifier value.
        Parameters:
        includeProperty - indices of the properties to include in the insert statement.
        Returns:
        The insert SQL statement string
      • generateDeleteString

        public java.lang.String generateDeleteString​(int j)
        Generate the SQL that deletes a row by id (and version)
      • dehydrate

        public int dehydrate​(java.io.Serializable id,
                             java.lang.Object[] fields,
                             boolean[] includeProperty,
                             boolean[][] includeColumns,
                             int j,
                             java.sql.PreparedStatement st,
                             SharedSessionContractImplementor session,
                             boolean isUpdate)
                      throws HibernateException,
                             java.sql.SQLException
        Throws:
        HibernateException
        java.sql.SQLException
      • dehydrate

        public int dehydrate​(java.io.Serializable id,
                             java.lang.Object[] fields,
                             java.lang.Object rowId,
                             boolean[] includeProperty,
                             boolean[][] includeColumns,
                             int j,
                             java.sql.PreparedStatement ps,
                             SharedSessionContractImplementor session,
                             int index,
                             boolean isUpdate)
                      throws java.sql.SQLException,
                             HibernateException
        Marshall the fields of a persistent instance to a prepared statement
        Throws:
        java.sql.SQLException
        HibernateException
      • hydrate

        public java.lang.Object[] hydrate​(java.sql.ResultSet rs,
                                          java.io.Serializable id,
                                          java.lang.Object object,
                                          Loadable rootLoadable,
                                          java.lang.String[][] suffixedPropertyColumns,
                                          boolean forceEager,
                                          boolean[] propertiesForceEager,
                                          SharedSessionContractImplementor session)
                                   throws java.sql.SQLException,
                                          HibernateException
        Unmarshal the fields of a persistent instance from a result set, without resolving associations or collections. Question: should this really be here, or should it be sent back to Loader?
        Specified by:
        hydrate in interface Loadable
        Throws:
        java.sql.SQLException
        HibernateException
      • useInsertSelectIdentity

        public boolean useInsertSelectIdentity()
      • useGetGeneratedKeys

        public boolean useGetGeneratedKeys()
      • getSequentialSelect

        protected java.lang.String getSequentialSelect​(java.lang.String entityName)
      • insert

        public java.io.Serializable insert​(java.lang.Object[] fields,
                                           boolean[] notNull,
                                           java.lang.String sql,
                                           java.lang.Object object,
                                           SharedSessionContractImplementor session)
                                    throws HibernateException
        Perform an SQL INSERT, and then retrieve a generated identifier.

        This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).

        Throws:
        HibernateException
      • getSelectByUniqueKeyString

        public java.lang.String getSelectByUniqueKeyString​(java.lang.String propertyName)
        Description copied from interface: PostInsertIdentityPersister
        Get a SQL select string that performs a select based on a unique key determined by the given property name).
        Specified by:
        getSelectByUniqueKeyString in interface PostInsertIdentityPersister
        Parameters:
        propertyName - The name of the property which maps to the column(s) to use in the select statement restriction.
        Returns:
        The SQL select string
      • insert

        public void insert​(java.io.Serializable id,
                           java.lang.Object[] fields,
                           boolean[] notNull,
                           int j,
                           java.lang.String sql,
                           java.lang.Object object,
                           SharedSessionContractImplementor session)
                    throws HibernateException
        Perform an SQL INSERT.

        This for is used for all non-root tables as well as the root table in cases where the identifier value is known before the insert occurs.

        Throws:
        HibernateException
      • updateOrInsert

        public void updateOrInsert​(java.io.Serializable id,
                                   java.lang.Object[] fields,
                                   java.lang.Object[] oldFields,
                                   java.lang.Object rowId,
                                   boolean[] includeProperty,
                                   int j,
                                   java.lang.Object oldVersion,
                                   java.lang.Object object,
                                   java.lang.String sql,
                                   SharedSessionContractImplementor session)
                            throws HibernateException
        Perform an SQL UPDATE or SQL INSERT
        Throws:
        HibernateException
      • update

        public boolean update​(java.io.Serializable id,
                              java.lang.Object[] fields,
                              java.lang.Object[] oldFields,
                              java.lang.Object rowId,
                              boolean[] includeProperty,
                              int j,
                              java.lang.Object oldVersion,
                              java.lang.Object object,
                              java.lang.String sql,
                              SharedSessionContractImplementor session)
                       throws HibernateException
        Throws:
        HibernateException
      • getUpdateStrings

        protected java.lang.String[] getUpdateStrings​(boolean byRowId,
                                                      boolean lazy)
      • preInsertInMemoryValueGeneration

        protected void preInsertInMemoryValueGeneration​(java.lang.Object[] fields,
                                                        java.lang.Object object,
                                                        SharedSessionContractImplementor session)
      • isAllOrDirtyOptLocking

        protected boolean isAllOrDirtyOptLocking()
      • generateSQLDeleteStrings

        protected java.lang.String[] generateSQLDeleteStrings​(java.lang.Object[] loadedState)
      • logStaticSQL

        protected void logStaticSQL()
      • filterFragment

        public java.lang.String filterFragment​(java.lang.String alias,
                                               java.util.Map enabledFilters)
                                        throws MappingException
        Description copied from interface: Joinable
        Get the where clause filter, given a query alias and considering enabled session filters
        Specified by:
        filterFragment in interface Joinable
        Throws:
        MappingException
      • filterFragment

        public java.lang.String filterFragment​(java.lang.String alias,
                                               java.util.Map enabledFilters,
                                               java.util.Set<java.lang.String> treatAsDeclarations)
        Description copied from interface: Joinable
        Get the where clause filter, given a query alias and considering enabled session filters
        Specified by:
        filterFragment in interface Joinable
      • generateFilterConditionAlias

        public java.lang.String generateFilterConditionAlias​(java.lang.String rootAlias)
        Description copied from interface: Queryable
        The alias used for any filter conditions (mapped where-fragments or enabled-filters).

        This may or may not be different from the root alias depending upon the inheritance mapping strategy.
        Specified by:
        generateFilterConditionAlias in interface Queryable
        Parameters:
        rootAlias - The root alias
        Returns:
        The alias used for "filter conditions" within the where clause.
      • oneToManyFilterFragment

        public java.lang.String oneToManyFilterFragment​(java.lang.String alias,
                                                        java.util.Set<java.lang.String> treatAsDeclarations)
        Specified by:
        oneToManyFilterFragment in interface Joinable
      • fromJoinFragment

        public java.lang.String fromJoinFragment​(java.lang.String alias,
                                                 boolean innerJoin,
                                                 boolean includeSubclasses)
        Description copied from interface: Joinable
        Get the from clause part of any joins (optional operation)
        Specified by:
        fromJoinFragment in interface Joinable
      • fromJoinFragment

        public java.lang.String fromJoinFragment​(java.lang.String alias,
                                                 boolean innerJoin,
                                                 boolean includeSubclasses,
                                                 java.util.Set<java.lang.String> treatAsDeclarations)
        Description copied from interface: Joinable
        Get the from clause part of any joins (optional operation)
        Specified by:
        fromJoinFragment in interface Joinable
      • fromJoinFragment

        public java.lang.String fromJoinFragment​(java.lang.String alias,
                                                 boolean innerJoin,
                                                 boolean includeSubclasses,
                                                 java.util.Set<java.lang.String> treatAsDeclarations,
                                                 java.util.Set<java.lang.String> referencedTables)
        Description copied from interface: Joinable
        Get the from clause part of any joins (optional operation)
        Specified by:
        fromJoinFragment in interface Joinable
      • whereJoinFragment

        public java.lang.String whereJoinFragment​(java.lang.String alias,
                                                  boolean innerJoin,
                                                  boolean includeSubclasses)
        Description copied from interface: Joinable
        Get the where clause part of any joins (optional operation)
        Specified by:
        whereJoinFragment in interface Joinable
      • whereJoinFragment

        public java.lang.String whereJoinFragment​(java.lang.String alias,
                                                  boolean innerJoin,
                                                  boolean includeSubclasses,
                                                  java.util.Set<java.lang.String> treatAsDeclarations)
        Description copied from interface: Joinable
        Get the where clause part of any joins (optional operation)
        Specified by:
        whereJoinFragment in interface Joinable
      • isSubclassTableLazy

        protected boolean isSubclassTableLazy​(int j)
      • createJoin

        protected JoinFragment createJoin​(java.lang.String name,
                                          boolean innerJoin,
                                          boolean includeSubclasses,
                                          java.util.Set<java.lang.String> treatAsDeclarations)
      • createJoin

        protected JoinFragment createJoin​(java.lang.String name,
                                          boolean innerJoin,
                                          boolean includeSubclasses,
                                          java.util.Set<java.lang.String> treatAsDeclarations,
                                          java.util.Set<java.lang.String> referencedTables)
      • determineSubclassTableJoinType

        protected JoinType determineSubclassTableJoinType​(int subclassTableNumber,
                                                          boolean canInnerJoin,
                                                          boolean includeSubclasses,
                                                          java.util.Set<java.lang.String> treatAsDeclarations)
      • determineSubclassTableJoinType

        protected JoinType determineSubclassTableJoinType​(int subclassTableNumber,
                                                          boolean canInnerJoin,
                                                          boolean includeSubclasses,
                                                          java.util.Set<java.lang.String> treatAsDeclarations,
                                                          java.util.Set<java.lang.String> referencedTables)
      • isSubclassTableIndicatedByTreatAsDeclarations

        protected boolean isSubclassTableIndicatedByTreatAsDeclarations​(int subclassTableNumber,
                                                                        java.util.Set<java.lang.String> treatAsDeclarations)
      • createJoin

        protected JoinFragment createJoin​(int[] tableNumbers,
                                          java.lang.String drivingAlias)
      • createSelect

        protected SelectFragment createSelect​(int[] subclassColumnNumbers,
                                              int[] subclassFormulaNumbers)
      • createFrom

        protected java.lang.String createFrom​(int tableNumber,
                                              java.lang.String alias)
      • createWhereByKey

        protected java.lang.String createWhereByKey​(int tableNumber,
                                                    java.lang.String alias)
      • renderSelect

        protected java.lang.String renderSelect​(int[] tableNumbers,
                                                int[] columnNumbers,
                                                int[] formulaNumbers)
      • postConstruct

        protected void postConstruct​(Mapping mapping)
                              throws MappingException
        Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing. It allows AbstractEntityPersister to extend its construction after all subclass-specific details have been handled.
        Parameters:
        mapping - The mapping
        Throws:
        MappingException - Indicates a problem accessing the Mapping
      • doPostInstantiate

        protected void doPostInstantiate()
      • createLoaders

        protected void createLoaders()
      • createQueryLoader

        protected void createQueryLoader()
      • load

        public java.lang.Object load​(java.io.Serializable id,
                                     java.lang.Object optionalObject,
                                     LockMode lockMode,
                                     SharedSessionContractImplementor session)
        Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter
        Specified by:
        load in interface EntityPersister
      • multiLoad

        public java.util.List multiLoad​(java.io.Serializable[] ids,
                                        SharedSessionContractImplementor session,
                                        MultiLoadOptions loadOptions)
        Description copied from interface: EntityPersister
        Performs a load of multiple entities (of this type) by identifier simultaneously.
        Specified by:
        multiLoad in interface EntityPersister
        Parameters:
        ids - The identifiers to load
        session - The originating Session
        loadOptions - The options for loading
        Returns:
        The loaded, matching entities
      • registerAffectingFetchProfile

        public void registerAffectingFetchProfile​(java.lang.String fetchProfileName)
        Description copied from interface: Loadable
        Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.
        Specified by:
        registerAffectingFetchProfile in interface Loadable
        Parameters:
        fetchProfileName - The name of the profile affecting this.
      • isAllNull

        public final boolean isAllNull​(java.lang.Object[] array,
                                       int tableNumber)
      • getPropertiesToUpdate

        public final boolean[] getPropertiesToUpdate​(int[] dirtyProperties,
                                                     boolean hasDirtyCollection)
        Transform the array of property indexes to an array of booleans, true when the property is dirty
      • getPropertiesToInsert

        public boolean[] getPropertiesToInsert​(java.lang.Object[] fields)
        Transform the array of property indexes to an array of booleans, true when the property is insertable and non-null
      • findDirty

        public int[] findDirty​(java.lang.Object[] currentState,
                               java.lang.Object[] previousState,
                               java.lang.Object entity,
                               SharedSessionContractImplementor session)
                        throws HibernateException
        Locate the property-indices of all properties considered to be dirty.
        Specified by:
        findDirty in interface EntityPersister
        Parameters:
        currentState - The current state of the entity (the state to be checked).
        previousState - The previous state of the entity (the state to be checked against).
        entity - The entity for which we are checking state dirtiness.
        session - The session in which the check is occurring.
        Returns:
        null or the indices of the dirty properties
        Throws:
        HibernateException
      • findModified

        public int[] findModified​(java.lang.Object[] old,
                                  java.lang.Object[] current,
                                  java.lang.Object entity,
                                  SharedSessionContractImplementor session)
                           throws HibernateException
        Locate the property-indices of all properties considered to be dirty.
        Specified by:
        findModified in interface EntityPersister
        Parameters:
        old - The old state of the entity.
        current - The current state of the entity.
        entity - The entity for which we are checking state modification.
        session - The session in which the check is occurring.
        Returns:
        null or the indices of the modified properties
        Throws:
        HibernateException
      • getPropertyUpdateability

        public boolean[] getPropertyUpdateability​(java.lang.Object entity)
        Which properties appear in the SQL update? (Initialized, updateable ones!)
      • getVersionComparator

        public java.util.Comparator getVersionComparator()
      • isPolymorphic

        public boolean isPolymorphic()
      • isInherited

        public boolean isInherited()
        Description copied from interface: EntityPersister
        Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.
        Specified by:
        isInherited in interface ClassMetadata
        Specified by:
        isInherited in interface EntityPersister
        Returns:
        True if other entities extend this entity; false otherwise.
      • hasCascades

        public boolean hasCascades()
        Description copied from interface: EntityPersister
        Determine whether this entity has any non-none cascading.
        Specified by:
        hasCascades in interface EntityPersister
        Returns:
        True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).
      • isVersioned

        public boolean isVersioned()
        Description copied from interface: EntityPersister
        Determine whether optimistic locking by column is enabled for this entity.
        Specified by:
        isVersioned in interface ClassMetadata
        Specified by:
        isVersioned in interface EntityPersister
        Returns:
        True if optimistic locking by column (i.e., or ) is enabled; false otherwise.
      • isIdentifierAssignedByInsert

        public boolean isIdentifierAssignedByInsert()
        Description copied from interface: EntityPersister
        Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.
        Specified by:
        isIdentifierAssignedByInsert in interface EntityPersister
        Returns:
        True if identifiers for this entity are generated by the insert execution.
      • hasLazyProperties

        public boolean hasLazyProperties()
        Description copied from interface: EntityPersister
        Determine whether this entity defines any lazy properties (ala bytecode instrumentation).
        Specified by:
        hasLazyProperties in interface EntityPersister
        Returns:
        True if the entity has properties mapped as lazy; false otherwise.
      • hasCollections

        public boolean hasCollections()
        Description copied from interface: EntityPersister
        Determine whether this entity contains references to persistent collections.
        Specified by:
        hasCollections in interface EntityPersister
        Returns:
        True if the entity does contain persistent collections; false otherwise.
      • hasMutableProperties

        public boolean hasMutableProperties()
        Description copied from interface: EntityPersister
        Determine whether any properties of this entity are considered mutable.
        Specified by:
        hasMutableProperties in interface EntityPersister
        Returns:
        True if any properties of the entity are mutable; false otherwise (meaning none are).
      • isMutable

        public boolean isMutable()
        Description copied from interface: EntityPersister
        Determine whether instances of this entity are considered mutable.
        Specified by:
        isMutable in interface ClassMetadata
        Specified by:
        isMutable in interface EntityPersister
        Returns:
        True if the entity is considered mutable; false otherwise.
      • isModifiableEntity

        public final boolean isModifiableEntity​(EntityEntry entry)
      • hasProxy

        public boolean hasProxy()
        Description copied from interface: EntityPersister
        Determine whether this entity supports dynamic proxies.
        Specified by:
        hasProxy in interface ClassMetadata
        Specified by:
        hasProxy in interface EntityPersister
        Returns:
        True if the entity has dynamic proxy support; false otherwise.
      • getRootEntityName

        public java.lang.String getRootEntityName()
        Description copied from interface: EntityPersister
        Returns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.
        Specified by:
        getRootEntityName in interface EntityPersister
        Returns:
        The root entity name.
      • getMappedSuperclass

        public java.lang.String getMappedSuperclass()
        Description copied from interface: Queryable
        Get the class that this class is mapped as a subclass of - not necessarily the direct superclass
        Specified by:
        getMappedSuperclass in interface Queryable
      • isExplicitPolymorphism

        public boolean isExplicitPolymorphism()
        Description copied from interface: Queryable
        Is this class explicit polymorphism only?
        Specified by:
        isExplicitPolymorphism in interface Queryable
      • useDynamicUpdate

        protected boolean useDynamicUpdate()
      • useDynamicInsert

        protected boolean useDynamicInsert()
      • hasEmbeddedCompositeIdentifier

        public boolean hasEmbeddedCompositeIdentifier()
      • canExtractIdOutOfEntity

        public boolean canExtractIdOutOfEntity()
        Description copied from interface: EntityPersister
        Determine whether detached instances of this entity carry their own identifier value.

        The other option is the deprecated feature where users could supply the id during session calls.

        Specified by:
        canExtractIdOutOfEntity in interface EntityPersister
        Returns:
        True if either (1) EntityPersister.hasIdentifierProperty() or (2) the identifier is an embedded composite identifier; false otherwise.
      • getKeyColumnNames

        public java.lang.String[] getKeyColumnNames()
        Description copied from interface: Joinable
        The columns to join on
        Specified by:
        getKeyColumnNames in interface Joinable
      • getName

        public java.lang.String getName()
        Description copied from interface: Joinable
        An identifying name; a class name or collection role name.
        Specified by:
        getName in interface Joinable
      • isCollection

        public boolean isCollection()
        Description copied from interface: Joinable
        Is this instance actually a CollectionPersister?
        Specified by:
        isCollection in interface Joinable
      • consumesEntityAlias

        public boolean consumesEntityAlias()
        Description copied from interface: Joinable
        Very, very, very ugly...
        Specified by:
        consumesEntityAlias in interface Joinable
        Returns:
        Does this persister "consume" entity column aliases in the result set?
      • consumesCollectionAlias

        public boolean consumesCollectionAlias()
        Description copied from interface: Joinable
        Very, very, very ugly...
        Specified by:
        consumesCollectionAlias in interface Joinable
        Returns:
        Does this persister "consume" collection column aliases in the result set?
      • getPropertyType

        public Type getPropertyType​(java.lang.String propertyName)
                             throws MappingException
        Get the type of a particular property by name. Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).
        Specified by:
        getPropertyType in interface ClassMetadata
        Specified by:
        getPropertyType in interface EntityPersister
        Parameters:
        propertyName - The name of the property for which to retrieve the type.
        Returns:
        The type.
        Throws:
        MappingException - Typically indicates an unknown property name.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • selectFragment

        public final java.lang.String selectFragment​(Joinable rhs,
                                                     java.lang.String rhsAlias,
                                                     java.lang.String lhsAlias,
                                                     java.lang.String entitySuffix,
                                                     java.lang.String collectionSuffix,
                                                     boolean includeCollectionColumns)
        Description copied from interface: Joinable
        All columns to select, when loading.
        Specified by:
        selectFragment in interface Joinable
      • hasInsertGeneratedProperties

        public boolean hasInsertGeneratedProperties()
        Description copied from interface: EntityPersister
        Does this entity define any properties as being database generated on insert?
        Specified by:
        hasInsertGeneratedProperties in interface EntityPersister
        Returns:
        True if this entity contains at least one property defined as generated (including version property, but not identifier).
      • hasUpdateGeneratedProperties

        public boolean hasUpdateGeneratedProperties()
        Description copied from interface: EntityPersister
        Does this entity define any properties as being database generated on update?
        Specified by:
        hasUpdateGeneratedProperties in interface EntityPersister
        Returns:
        True if this entity contains at least one property defined as generated (including version property, but not identifier).
      • isVersionPropertyGenerated

        public boolean isVersionPropertyGenerated()
        Description copied from interface: EntityPersister
        Does this entity contain a version property that is defined to be database generated?
        Specified by:
        isVersionPropertyGenerated in interface EntityPersister
        Returns:
        true if this entity contains a version property and that property has been marked as generated.
      • isVersionPropertyInsertable

        public boolean isVersionPropertyInsertable()
        Description copied from interface: Queryable
        Is the version property included in insert statements?
        Specified by:
        isVersionPropertyInsertable in interface Queryable
      • getPropertyUpdateability

        public boolean[] getPropertyUpdateability()
        Description copied from interface: EntityPersister
        Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)
        Specified by:
        getPropertyUpdateability in interface EntityPersister
      • getPropertyCheckability

        public boolean[] getPropertyCheckability()
        Description copied from interface: EntityPersister
        Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)
        Specified by:
        getPropertyCheckability in interface EntityPersister
      • getNonLazyPropertyUpdateability

        public boolean[] getNonLazyPropertyUpdateability()
      • getPropertyInsertability

        public boolean[] getPropertyInsertability()
        Description copied from interface: EntityPersister
        Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)
        Specified by:
        getPropertyInsertability in interface EntityPersister
      • getPropertyVersionability

        public boolean[] getPropertyVersionability()
        Description copied from interface: EntityPersister
        Get the "versionability" of the properties of this class (is the property optimistic-locked)
        Specified by:
        getPropertyVersionability in interface EntityPersister
      • getConcreteProxyClass

        public java.lang.Class getConcreteProxyClass()
        Description copied from interface: EntityPersister
        Get the proxy interface that instances of this concrete class will be cast to (optional operation).
        Specified by:
        getConcreteProxyClass in interface EntityPersister
      • setPropertyValue

        public void setPropertyValue​(java.lang.Object object,
                                     int i,
                                     java.lang.Object value)
        Description copied from interface: EntityPersister
        Set the value of a particular property
        Specified by:
        setPropertyValue in interface EntityPersister
      • getPropertyValues

        public java.lang.Object[] getPropertyValues​(java.lang.Object object)
        Description copied from interface: EntityPersister
        Return the (loaded) values of the mapped properties of the object (not including backrefs)
        Specified by:
        getPropertyValues in interface ClassMetadata
        Specified by:
        getPropertyValues in interface EntityPersister
        Parameters:
        object - The entity from which to extract the property values.
        Returns:
        The property values.
      • getPropertyValue

        public java.lang.Object getPropertyValue​(java.lang.Object object,
                                                 int i)
        Description copied from interface: EntityPersister
        Get the value of a particular property
        Specified by:
        getPropertyValue in interface EntityPersister
      • getIdentifier

        public java.io.Serializable getIdentifier​(java.lang.Object entity,
                                                  SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Get the identifier of an instance (throw an exception if no identifier property)
        Specified by:
        getIdentifier in interface ClassMetadata
        Specified by:
        getIdentifier in interface EntityPersister
        Parameters:
        entity - The entity for which to get the identifier
        session - The session from which the request originated
        Returns:
        The identifier
      • setIdentifier

        public void setIdentifier​(java.lang.Object entity,
                                  java.io.Serializable id,
                                  SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Inject the identifier value into the given entity.
        Specified by:
        setIdentifier in interface ClassMetadata
        Specified by:
        setIdentifier in interface EntityPersister
        Parameters:
        entity - The entity to inject with the identifier value.
        id - The value to be injected as the identifier.
        session - The session from which is requests originates
      • getVersion

        public java.lang.Object getVersion​(java.lang.Object object)
        Description copied from interface: EntityPersister
        Get the version number (or timestamp) from the object's version property (or return null if not versioned)
        Specified by:
        getVersion in interface ClassMetadata
        Specified by:
        getVersion in interface EntityPersister
      • instantiate

        public java.lang.Object instantiate​(java.io.Serializable id,
                                            SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Create a class instance initialized with the given identifier
        Specified by:
        instantiate in interface ClassMetadata
        Specified by:
        instantiate in interface EntityPersister
        Parameters:
        id - The identifier value to use (may be null to represent no value)
        session - The session from which the request originated.
        Returns:
        The instantiated entity.
      • isInstance

        public boolean isInstance​(java.lang.Object object)
        Description copied from interface: EntityPersister
        Is the given object an instance of this entity?
        Specified by:
        isInstance in interface EntityPersister
      • hasUninitializedLazyProperties

        public boolean hasUninitializedLazyProperties​(java.lang.Object object)
        Description copied from interface: EntityPersister
        Does the given instance have any uninitialized lazy properties?
        Specified by:
        hasUninitializedLazyProperties in interface EntityPersister
      • resetIdentifier

        public void resetIdentifier​(java.lang.Object entity,
                                    java.io.Serializable currentId,
                                    java.lang.Object currentVersion,
                                    SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Set the identifier and version of the given instance back to its "unsaved" value.
        Specified by:
        resetIdentifier in interface EntityPersister
        Parameters:
        entity - The entity instance
        currentId - The currently assigned identifier value.
        currentVersion - The currently assigned version value.
        session - The session from which the request originated.
      • getSubclassEntityPersister

        public EntityPersister getSubclassEntityPersister​(java.lang.Object instance,
                                                          SessionFactoryImplementor factory)
        Description copied from interface: EntityPersister
        A request has already identified the entity-name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially re-route to the more appropriate persister.

        For example, a request names Animal as the entity-name which gets resolved to this persister. But the actual instance is really an instance of Cat which is a subclass of Animal. So, here the Animal persister is being asked to return the persister specific to Cat.

        It is also possible that the instance is actually an Animal instance in the above example in which case we would return this from this method.

        Specified by:
        getSubclassEntityPersister in interface EntityPersister
        Parameters:
        instance - The entity instance
        factory - Reference to the SessionFactory
        Returns:
        The appropriate persister
      • isMultiTable

        public boolean isMultiTable()
        Description copied from interface: Queryable
        Is the inheritance hierarchy described by this persister contained across multiple tables?
        Specified by:
        isMultiTable in interface Queryable
        Returns:
        True if the inheritance hierarchy is spread across multiple tables; false otherwise.
      • getPropertySpan

        public int getPropertySpan()
      • processInsertGeneratedProperties

        public void processInsertGeneratedProperties​(java.io.Serializable id,
                                                     java.lang.Object entity,
                                                     java.lang.Object[] state,
                                                     SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.

        Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.

        Specified by:
        processInsertGeneratedProperties in interface EntityPersister
        Parameters:
        id - The entity's id value.
        entity - The entity for which to get the state.
        session - The session
      • processUpdateGeneratedProperties

        public void processUpdateGeneratedProperties​(java.io.Serializable id,
                                                     java.lang.Object entity,
                                                     java.lang.Object[] state,
                                                     SharedSessionContractImplementor session)
        Description copied from interface: EntityPersister
        Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to the PersistenceContext.

        Note, that because we update the PersistenceContext here, callers need to take care that they have already written the initial snapshot to the PersistenceContext before calling this method.

        Specified by:
        processUpdateGeneratedProperties in interface EntityPersister
        Parameters:
        id - The entity's id value.
        entity - The entity for which to get the state.
        session - The session
      • hasSubselectLoadableCollections

        public boolean hasSubselectLoadableCollections()
        Description copied from interface: EntityPersister
        Determine whether this entity contains references to persistent collections which are fetchable by subselect?
        Specified by:
        hasSubselectLoadableCollections in interface EntityPersister
        Returns:
        True if the entity contains collections fetchable by subselect; false otherwise.
      • determineValueNullness

        public static boolean[] determineValueNullness​(java.lang.Object[] naturalIdValues)
      • determinePkByNaturalIdQuery

        @Deprecated
        protected java.lang.String determinePkByNaturalIdQuery​(boolean[] valueNullness)
        Deprecated.
      • isNaturalIdNonNullable

        public boolean isNaturalIdNonNullable()
      • concretePropertySelectFragmentSansLeadingComma

        protected java.lang.String concretePropertySelectFragmentSansLeadingComma​(java.lang.String alias,
                                                                                  boolean[] include)
      • setPropertyValue

        public void setPropertyValue​(java.lang.Object object,
                                     java.lang.String propertyName,
                                     java.lang.Object value)
        Description copied from interface: ClassMetadata
        Set the value of a particular (named) property
        Specified by:
        setPropertyValue in interface ClassMetadata
      • getTableId

        public static int getTableId​(java.lang.String tableName,
                                     java.lang.String[] tables)
      • getTableAliasForColumn

        public java.lang.String getTableAliasForColumn​(java.lang.String columnName,
                                                       java.lang.String rootAlias)
        Description copied from interface: Loadable
        Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias for the table in that hierarchy that contains said column.

        NOTE : Generally speaking the column is not validated to exist. Most implementations simply return the root alias; the exception is JoinedSubclassEntityPersister

        Specified by:
        getTableAliasForColumn in interface Loadable
        Parameters:
        columnName - The column name
        rootAlias - The hierarchy root alias
        Returns:
        The proper table alias for qualifying the given column.
      • determineTableNumberForColumn

        public int determineTableNumberForColumn​(java.lang.String columnName)
      • determineTableName

        protected java.lang.String determineTableName​(Table table)
      • getPolymorphicJoinColumns

        public java.lang.String[][] getPolymorphicJoinColumns​(java.lang.String lhsTableAlias,
                                                              java.lang.String propertyPath)
      • canOmitSuperclassTableJoin

        public boolean canOmitSuperclassTableJoin()
        If true, persister can omit superclass tables during joining if they are not needed in the query.
        Returns:
        true if the persister can do it
      • createInsert

        protected Insert createInsert()
      • createUpdate

        protected Update createUpdate()
      • createDelete

        protected Delete createDelete()