Package org.hibernate.persister.entity
Class AbstractEntityPersister
- java.lang.Object
-
- org.hibernate.persister.entity.AbstractEntityPersister
-
- All Implemented Interfaces:
LazyPropertyInitializer,PostInsertIdentityPersister,ClassMetadata,EntityPersister,Joinable,Loadable,Lockable,OuterJoinLoadable,PropertyMapping,Queryable,SQLLoadable,UniqueKeyLoadable,AttributeSource,EntityDefinition
- Direct Known Subclasses:
JoinedSubclassEntityPersister,SingleTableEntityPersister,UnionSubclassEntityPersister
public abstract class AbstractEntityPersister extends java.lang.Object implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister, Lockable
Basic functionality for persisting an entity via JDBC through either generated or custom SQL
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractEntityPersister.CacheEntryHelperConsolidated these onto a single helper because the 2 pieces work in tandem.protected static interfaceAbstractEntityPersister.InclusionChecker-
Nested classes/interfaces inherited from interface org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer
LazyPropertyInitializer.InterceptorImplementor
-
Nested classes/interfaces inherited from interface org.hibernate.persister.entity.Queryable
Queryable.Declarer
-
-
Field Summary
Fields Modifier and Type Field Description protected intbatchSizeprotected java.lang.String[]customSQLDeleteprotected java.lang.String[]customSQLInsertprotected java.lang.String[]customSQLUpdateprotected boolean[]deleteCallableprotected ExecuteUpdateResultCheckStyle[]deleteResultCheckStylesstatic java.lang.StringENTITY_CLASSprotected boolean[]insertCallableprotected ExecuteUpdateResultCheckStyle[]insertResultCheckStylesprotected BasicEntityPropertyMappingpropertyMappingWarning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties.protected java.lang.StringrowIdNameprotected boolean[]updateCallableprotected ExecuteUpdateResultCheckStyle[]updateResultCheckStylesstatic java.lang.StringVERSION_COLUMN_ALIAS-
Fields inherited from interface org.hibernate.persister.entity.EntityPersister
ENTITY_ID
-
Fields inherited from interface org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer
UNFETCHED_PROPERTY
-
Fields inherited from interface org.hibernate.persister.entity.Loadable
ROWID_ALIAS
-
-
Constructor Summary
Constructors Constructor Description AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, PersisterCreationContext creationContext)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddDiscriminatorToInsert(Insert insert)protected voidaddDiscriminatorToSelect(SelectFragment select, java.lang.String name, java.lang.String suffix)voidafterInitialize(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entities properties have been initializedvoidafterReassociate(java.lang.Object entity, SharedSessionContractImplementor session)Called just after the entity has been reassociated with the sessionCacheEntrybuildCacheEntry(java.lang.Object entity, java.lang.Object[] state, java.lang.Object version, SharedSessionContractImplementor session)protected AbstractEntityPersister.CacheEntryHelperbuildCacheEntryHelper()protected UniqueEntityLoaderbuildMergeCascadeEntityLoader(LockMode ignored)protected UniqueEntityLoaderbuildRefreshCascadeEntityLoader(LockMode ignored)booleancanExtractIdOutOfEntity()Determine whether detached instances of this entity carry their own identifier value.booleancanOmitSuperclassTableJoin()If true, persister can omit superclass tables during joining if they are not needed in the query.booleancanReadFromCache()booleancanUseReferenceCacheEntries()booleancanWriteToCache()protected booleancheck(int rows, java.io.Serializable id, int tableNumber, Expectation expectation, java.sql.PreparedStatement statement, java.lang.String statementSQL)booleancheckVersion(boolean[] includeProperty)protected java.lang.StringconcretePropertySelectFragment(java.lang.String alias, boolean[] includeProperty)protected java.lang.StringconcretePropertySelectFragment(java.lang.String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)protected java.lang.StringconcretePropertySelectFragmentSansLeadingComma(java.lang.String alias, boolean[] include)booleanconsumesCollectionAlias()Very, very, very ugly...booleanconsumesEntityAlias()Very, very, very ugly...intcountSubclassProperties()How many properties are there, for this class and all subclasses?protected DeletecreateDelete()protected UniqueEntityLoadercreateEntityLoader(LockMode lockMode)Used internally to create static loaders.protected UniqueEntityLoadercreateEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)protected UniqueEntityLoadercreateEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)protected java.lang.StringcreateFrom(int tableNumber, java.lang.String alias)protected InsertcreateInsert()protected JoinFragmentcreateJoin(int[] tableNumbers, java.lang.String drivingAlias)protected JoinFragmentcreateJoin(java.lang.String name, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)protected JoinFragmentcreateJoin(java.lang.String name, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations, java.util.Set<java.lang.String> referencedTables)protected voidcreateLoaders()protected voidcreateNaturalIdLoaders()java.lang.ObjectcreateProxy(java.io.Serializable id, SharedSessionContractImplementor session)Create a new proxy instanceprotected voidcreateQueryLoader()protected SelectFragmentcreateSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)protected UniqueEntityLoadercreateUniqueKeyLoader(Type uniqueKeyType, java.lang.String[] columns, LoadQueryInfluencers loadQueryInfluencers)protected voidcreateUniqueKeyLoaders()protected UpdatecreateUpdate()protected java.lang.StringcreateWhereByKey(int tableNumber, java.lang.String alias)intdehydrate(java.io.Serializable id, java.lang.Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, java.sql.PreparedStatement st, SharedSessionContractImplementor session, boolean isUpdate)intdehydrate(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)Marshall the fields of a persistent instance to a prepared statementvoiddelete(java.io.Serializable id, java.lang.Object version, int j, java.lang.Object object, java.lang.String sql, SharedSessionContractImplementor session, java.lang.Object[] loadedState)Perform an SQL DELETEvoiddelete(java.io.Serializable id, java.lang.Object version, java.lang.Object object, SharedSessionContractImplementor session)Delete an objectprotected java.lang.StringdeterminePkByNaturalIdQuery(boolean[] valueNullness)Deprecated.protected JoinTypedetermineSubclassTableJoinType(int subclassTableNumber, boolean canInnerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)protected JoinTypedetermineSubclassTableJoinType(int subclassTableNumber, boolean canInnerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations, java.util.Set<java.lang.String> referencedTables)protected java.lang.StringdetermineTableName(Table table)intdetermineTableNumberForColumn(java.lang.String columnName)static boolean[]determineValueNullness(java.lang.Object[] naturalIdValues)protected voiddoPostInstantiate()protected abstract java.lang.StringfilterFragment(java.lang.String alias)java.lang.StringfilterFragment(java.lang.String alias, java.util.Map enabledFilters)Get the where clause filter, given a query alias and considering enabled session filtersjava.lang.StringfilterFragment(java.lang.String alias, java.util.Map enabledFilters, java.util.Set<java.lang.String> treatAsDeclarations)Get the where clause filter, given a query alias and considering enabled session filtersprotected abstract java.lang.StringfilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)int[]findDirty(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.Object entity, SharedSessionContractImplementor session)Locate the property-indices of all properties considered to be dirty.int[]findModified(java.lang.Object[] old, java.lang.Object[] current, java.lang.Object entity, SharedSessionContractImplementor session)Locate the property-indices of all properties considered to be dirty.java.lang.ObjectforceVersionIncrement(java.io.Serializable id, java.lang.Object currentVersion, SharedSessionContractImplementor session)java.lang.StringfromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)Get the from clause part of any joins (optional operation)java.lang.StringfromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)Get the from clause part of any joins (optional operation)java.lang.StringfromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations, java.util.Set<java.lang.String> referencedTables)Get the from clause part of any joins (optional operation)java.lang.StringgenerateDeleteString(int j)Generate the SQL that deletes a row by id (and version)voidgenerateEntityDefinition()Generate the entity definition for this object.java.lang.StringgenerateFilterConditionAlias(java.lang.String rootAlias)The alias used for any filter conditions (mapped where-fragments or enabled-filters).java.lang.StringgenerateIdByUniqueKeySelectString(java.lang.String uniquePropertyName)java.lang.StringgenerateIdentityInsertString(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.java.lang.StringgenerateInsertGeneratedValuesSelectString()java.lang.StringgenerateInsertString(boolean[] includeProperty, int j)java.lang.StringgenerateInsertString(boolean identityInsert, boolean[] includeProperty)java.lang.StringgenerateInsertString(boolean identityInsert, boolean[] includeProperty, int j)Generate the SQL that inserts a rowprotected java.util.Map<java.lang.String,java.lang.String>generateLazySelectStringsByFetchGroup()protected LockingStrategygenerateLocker(LockMode lockMode)java.lang.StringgenerateSelectVersionString()Generate the SQL that selects the version number by idjava.lang.StringgenerateSnapshotSelectString()protected java.lang.String[]generateSQLDeleteStrings(java.lang.Object[] loadedState)static java.lang.StringgenerateTableAlias(java.lang.String rootAlias, int tableNumber)java.lang.StringgenerateUpdateGeneratedValuesSelectString()java.lang.StringgenerateUpdateString(boolean[] includeProperty, int j, boolean useRowId)java.lang.StringgenerateUpdateString(boolean[] includeProperty, int j, java.lang.Object[] oldFields, boolean useRowId)Generate the SQL that updates a row by id (and version)protected UniqueEntityLoadergetAppropriateLoader(LockOptions lockOptions, SharedSessionContractImplementor session)protected UniqueEntityLoadergetAppropriateUniqueKeyLoader(java.lang.String propertyName, SharedSessionContractImplementor session)java.lang.Iterable<AttributeDefinition>getAttributes()BytecodeEnhancementMetadatagetBytecodeEnhancementMetadata()EntityDataAccessgetCacheAccessStrategy()Get the cache (optional operation)CacheEntryStructuregetCacheEntryStructure()Get the cache structureCascadeStylegetCascadeStyle(int i)Get the cascade style of this (subclass closure) propertyClassMetadatagetClassMetadata()Get the user-visible metadata for the class (optional operation)protected java.io.SerializablegetCollectionKey(CollectionPersister persister, java.lang.Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)java.lang.ClassgetConcreteProxyClass()Get the proxy interface that instances of this concrete class will be cast to (optional operation).java.lang.ObjectgetCurrentVersion(java.io.Serializable id, SharedSessionContractImplementor session)Retrieve the version numberjava.lang.Object[]getDatabaseSnapshot(java.io.Serializable id, SharedSessionContractImplementor session)Get the current database state of the object, in a "hydrated" form, without resolving identifiersExecuteUpdateResultCheckStyle[]getDeleteResultCheckStyles()java.lang.StringgetDiscriminatorAlias()java.lang.StringgetDiscriminatorAlias(java.lang.String suffix)Get the result set aliases used for the identifier columns, given a suffixjava.lang.StringgetDiscriminatorColumnName()java.lang.StringgetDiscriminatorColumnReaders()java.lang.StringgetDiscriminatorColumnReaderTemplate()java.lang.StringgetDiscriminatorFormulaTemplate()EntityEntryFactorygetEntityEntryFactory()Get the EntityEntryFactory indicated for the entity mapped by this persister.EntityIdentifierDefinitiongetEntityKeyDefinition()EntityMetamodelgetEntityMetamodel()Retrieve the underlying entity metamodel instance...EntityModegetEntityMode()java.lang.StringgetEntityName()The entity name which this persister maps.EntityPersistergetEntityPersister()EntityTuplizergetEntityTuplizer()EntityTypegetEntityType()SessionFactoryImplementorgetFactory()Return the SessionFactory to which this persister "belongs".FetchModegetFetchMode(int i)May this (subclass closure) property be fetched using an SQL outerjoin?java.io.SerializablegetIdByUniqueKey(java.io.Serializable key, java.lang.String uniquePropertyName, SharedSessionContractImplementor session)java.io.SerializablegetIdentifier(java.lang.Object object)Get the identifier of an instance (throw an exception if no identifier property)java.io.SerializablegetIdentifier(java.lang.Object entity, SharedSessionContractImplementor session)Get the identifier of an instance (throw an exception if no identifier property)java.lang.String[]getIdentifierAliases()java.lang.String[]getIdentifierAliases(java.lang.String suffix)Get the result set aliases used for the identifier columns, given a suffixjava.lang.String[]getIdentifierColumnNames()Get the names of columns used to persist the identifierjava.lang.String[]getIdentifierColumnReaders()java.lang.String[]getIdentifierColumnReaderTemplates()intgetIdentifierColumnSpan()IdentifierGeneratorgetIdentifierGenerator()Determine which identifier generation strategy is used for this entity.java.lang.StringgetIdentifierPropertyName()Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyTypegetIdentifierType()Get the identifier typeInsertGeneratedIdentifierDelegategetIdentityDelegate()Deprecated.Exposed for tests onlyjava.lang.StringgetIdentitySelectString()Get the database-specific SQL command to retrieve the last generated IDENTITY value.ExecuteUpdateResultCheckStyle[]getInsertResultCheckStyles()BytecodeEnhancementMetadatagetInstrumentationMetadata()java.lang.String[]getKeyColumnNames()The columns to join onabstract java.lang.String[]getKeyColumns(int j)protected java.lang.String[][]getLazyPropertyColumnAliases()protected java.lang.String[]getLazyPropertyNames()protected int[]getLazyPropertyNumbers()protected Type[]getLazyPropertyTypes()protected UniqueEntityLoadergetLoaderByLockMode(LockMode lockMode)java.lang.ClassgetMappedClass()The persistent class, or nulljava.lang.StringgetMappedSuperclass()Get the class that this class is mapped as a subclass of - not necessarily the direct superclassjava.lang.StringgetName()An identifying name; a class name or collection role name.NaturalIdDataAccessgetNaturalIdCacheAccessStrategy()Get the NaturalId cache (optional operation)int[]getNaturalIdentifierProperties()If the entity defines a natural id (EntityPersister.hasNaturalIdentifier()), which properties make up the natural id.java.lang.Object[]getNaturalIdentifierSnapshot(java.io.Serializable id, SharedSessionContractImplementor session)Retrieve the current state of the natural-id properties from the database.NavigableRolegetNavigableRole()boolean[]getNonLazyPropertyUpdateability()java.lang.String[][]getPolymorphicJoinColumns(java.lang.String lhsTableAlias, java.lang.String propertyPath)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-nullboolean[]getPropertiesToUpdate(int[] dirtyProperties, boolean hasDirtyCollection)Transform the array of property indexes to an array of booleans, true when the property is dirtyjava.lang.String[]getPropertyAliases(java.lang.String suffix, int i)Get the result set aliases used for the property columns, given a suffix (properties of this class, only).CascadeStyle[]getPropertyCascadeStyles()Get the cascade styles of the properties (optional operation)boolean[]getPropertyCheckability()Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)boolean[][]getPropertyColumnInsertable()java.lang.String[]getPropertyColumnNames(int i)Get the result set column names mapped for this property (properties of this class, only).java.lang.String[]getPropertyColumnNames(java.lang.String propertyName)Get the column names for the given property pathintgetPropertyColumnSpan(int i)boolean[][]getPropertyColumnUpdateable()java.lang.String[]getPropertyColumnWriters(int i)intgetPropertyIndex(java.lang.String propertyName)Get the property number of the unique key propertyboolean[]getPropertyInsertability()Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)ValueInclusion[]getPropertyInsertGenerationInclusions()Deprecated.no simple, direct replacementboolean[]getPropertyLaziness()Get the "laziness" of the properties of this classjava.lang.String[]getPropertyNames()Get the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)boolean[]getPropertyNullability()Get the nullability of the properties of this classboolean[]getPropertySelectable()intgetPropertySpan()protected java.lang.String[]getPropertySubclassNames()protected abstract int[]getPropertyTableNumbers()protected abstract int[]getPropertyTableNumbersInSelect()TypegetPropertyType(java.lang.String propertyName)Get the type of a particular property by name.Type[]getPropertyTypes()Get the Hibernate types of the class propertiesboolean[]getPropertyUniqueness()boolean[]getPropertyUpdateability()Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)boolean[]getPropertyUpdateability(java.lang.Object entity)Which properties appear in the SQL update? (Initialized, updateable ones!)ValueInclusion[]getPropertyUpdateGenerationInclusions()Deprecated.no simple, direct replacementjava.lang.ObjectgetPropertyValue(java.lang.Object object, int i)Get the value of a particular propertyjava.lang.ObjectgetPropertyValue(java.lang.Object object, java.lang.String propertyName)Get the value of a particular propertyjava.lang.Object[]getPropertyValues(java.lang.Object object)Return the (loaded) values of the mapped properties of the object (not including backrefs)java.lang.Object[]getPropertyValuesToInsert(java.lang.Object object, java.util.Map mergeMap, SharedSessionContractImplementor session)Return the values of the insertable properties of the object (including backrefs)boolean[]getPropertyVersionability()Get the "versionability" of the properties of this class (is the property optimistic-locked)java.io.Serializable[]getQuerySpaces()Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses.java.lang.StringgetRootEntityName()Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.java.lang.StringgetRootTableAlias(java.lang.String drivingAlias)Get the SQL alias this persister would use for the root table given the passed driving alias.java.lang.String[]getRootTableIdentifierColumnNames()Get the names of columns on the root table used to persist the identifier.java.lang.String[]getRootTableKeyColumnNames()The names of the primary key columns in the root table.java.lang.StringgetRootTableName()Locks are always applied to the "root table".java.lang.StringgetSelectByUniqueKeyString(java.lang.String propertyName)Get a SQL select string that performs a select based on a unique key determined by the given property name).protected java.lang.StringgetSequentialSelect(java.lang.String entityName)java.lang.String[]getSQLDeleteStrings()java.lang.StringgetSQLIdentityInsertString()The query that inserts a row, letting the database generate an idjava.lang.String[]getSQLInsertStrings()java.lang.StringgetSQLLazySelectString(java.lang.String fetchGroup)java.lang.String[]getSQLLazyUpdateByRowIdStrings()java.lang.String[]getSQLLazyUpdateStrings()java.lang.StringgetSQLSnapshotSelectString()java.lang.String[]getSQLUpdateByRowIdStrings()java.lang.String[]getSQLUpdateStrings()protected java.lang.StringgetSQLWhereString(java.lang.String alias)protected java.lang.String[]getSubclassColumnAliasClosure()protected java.lang.String[]getSubclassColumnClosure()protected boolean[]getSubclassColumnLazyiness()java.lang.String[]getSubclassColumnReaderTemplateClosure()protected abstract int[]getSubclassColumnTableNumberClosure()EntityPersistergetSubclassEntityPersister(java.lang.Object instance, SessionFactoryImplementor factory)A request has already identified the entity-name of this persister as the mapping for the given instance.protected java.lang.String[]getSubclassFormulaAliasClosure()protected java.lang.String[]getSubclassFormulaClosure()protected boolean[]getSubclassFormulaLazyiness()protected abstract int[]getSubclassFormulaTableNumberClosure()protected java.lang.String[]getSubclassFormulaTemplateClosure()java.lang.String[]getSubclassPropertyColumnAliases(java.lang.String propertyName, java.lang.String suffix)Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).protected java.lang.String[][]getSubclassPropertyColumnNameClosure()java.lang.String[]getSubclassPropertyColumnNames(int i)Return the column names used to persist the numbered property of the class or a subclass.java.lang.String[]getSubclassPropertyColumnNames(java.lang.String propertyName)Return the column names used to persist/query the named property of the class or a subclass (optional operation).java.lang.String[][]getSubclassPropertyColumnReaderClosure()java.lang.String[][]getSubclassPropertyColumnReaderTemplateClosure()Queryable.DeclarergetSubclassPropertyDeclarer(java.lang.String propertyPath)Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...java.lang.String[][]getSubclassPropertyFormulaTemplateClosure()java.lang.StringgetSubclassPropertyName(int i)Get the name of the numbered property of the class or a subclass.protected java.lang.String[]getSubclassPropertyNameClosure()protected java.lang.String[]getSubclassPropertySubclassNameClosure()protected abstract intgetSubclassPropertyTableNumber(int i)intgetSubclassPropertyTableNumber(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.TypegetSubclassPropertyType(int i)Get the type of the numbered property of the class or a subclass.protected Type[]getSubclassPropertyTypeClosure()protected abstract java.lang.String[]getSubclassTableKeyColumns(int j)abstract java.lang.StringgetSubclassTableName(int j)Get the name of the table with the given index from the internal array.abstract intgetSubclassTableSpan()java.lang.StringgetTableAliasForColumn(java.lang.String columnName, java.lang.String rootAlias)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.static intgetTableId(java.lang.String tableName, java.lang.String[] tables)abstract java.lang.StringgetTableName(int j)java.lang.String[]getTableNames()abstract intgetTableSpan()boolean[]getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)Decide which tables need to be updated.protected static java.lang.StringgetTemplateFromString(java.lang.String string, SessionFactoryImplementor factory)TypegetType()Get the type of the thing containing the propertiesDiscriminatorMetadatagetTypeDiscriminatorMetadata()Retrieve the information needed to properly deal with this entity's discriminator in a query.ExecuteUpdateResultCheckStyle[]getUpdateResultCheckStyles()protected java.lang.String[]getUpdateStrings(boolean byRowId, boolean lazy)java.lang.ObjectgetVersion(java.lang.Object object)Get the version number (or timestamp) from the object's version property (or return null if not versioned)java.lang.StringgetVersionColumnName()For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.java.util.ComparatorgetVersionComparator()java.lang.StringgetVersionedTableName()intgetVersionProperty()IfEntityPersister.isVersioned(), then what is the index of the property holding the locking value.java.lang.StringgetVersionSelectString()VersionTypegetVersionType()IfEntityPersister.isVersioned(), then what is the type of the property holding the locking value.booleanhasCache()Does this class have a cache.booleanhasCascades()Determine whether this entity has any non-none cascading.booleanhasCollections()Determine whether this entity contains references to persistent collections.booleanhasEmbeddedCompositeIdentifier()booleanhasFormulaProperties()booleanhasIdentifierProperty()Determine whether the entity has a particular property holding the identifier value.booleanhasInsertGeneratedProperties()Does this entity define any properties as being database generated on insert?booleanhasLazyProperties()Determine whether this entity defines any lazy properties (ala bytecode instrumentation).booleanhasMutableProperties()Determine whether any properties of this entity are considered mutable.booleanhasNaturalIdCache()Does this class have a natural id cachebooleanhasNaturalIdentifier()Determine whether this entity defines a natural identifier.booleanhasProxy()Determine whether this entity supports dynamic proxies.booleanhasRowId()Does the result set contain rowids?booleanhasSequentialSelect()booleanhasSubclasses()Does this persistent class have subclasses?booleanhasSubselectLoadableCollections()Determine whether this entity contains references to persistent collections which are fetchable by subselect?booleanhasUninitializedLazyProperties(java.lang.Object object)Does the given instance have any uninitialized lazy properties?booleanhasUpdateGeneratedProperties()Does this entity define any properties as being database generated on update?protected booleanhasWhere()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)Unmarshal the fields of a persistent instance from a result set, without resolving associations or collections.java.lang.StringidentifierSelectFragment(java.lang.String name, java.lang.String suffix)Given a query alias and an identifying suffix, render the identifier select fragment.booleanimplementsLifecycle()Does the class implement theLifecycleinterface.java.lang.ObjectinitializeEnhancedEntityUsedAsProxy(java.lang.Object entity, java.lang.String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)Called fromEnhancementAsProxyLazinessInterceptorto trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy stateprotected java.lang.ObjectinitializeLazyPropertiesFromCache(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session, EntityEntry entry, CacheEntry cacheEntry)protected java.lang.ObjectinitializeLazyPropertiesFromDatastore(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session, java.io.Serializable id, EntityEntry entry)java.lang.ObjectinitializeLazyProperty(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session)Initialize the property, and return its new value.protected booleaninitializeLazyProperty(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session, EntityEntry entry, int j, java.lang.Object propValue)protected voidinitPropertyPaths(Mapping mapping)protected voidinitSubclassPropertyAliasesMap(PersistentClass model)Must be called by subclasses, at the end of their constructorsvoidinsert(java.io.Serializable id, java.lang.Object[] fields, boolean[] notNull, int j, java.lang.String sql, java.lang.Object object, SharedSessionContractImplementor session)Perform an SQL INSERT.voidinsert(java.io.Serializable id, java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)Persist an instancejava.io.Serializableinsert(java.lang.Object[] fields, boolean[] notNull, java.lang.String sql, java.lang.Object object, SharedSessionContractImplementor session)Perform an SQL INSERT, and then retrieve a generated identifier.java.io.Serializableinsert(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)Persist an instance, using a natively generated identifier (optional operation)java.lang.Objectinstantiate(java.io.Serializable id, SharedSessionContractImplementor session)Create a class instance initialized with the given identifierbooleanisAbstract()Is this an abstract class?booleanisAllNull(java.lang.Object[] array, int tableNumber)protected booleanisAllOrDirtyOptLocking()booleanisBatchable()booleanisBatchLoadable()Is batch loading enabled?booleanisCacheInvalidationRequired()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.protected booleanisClassOrSuperclassJoin(int j)protected abstract booleanisClassOrSuperclassTable(int j)booleanisCollection()Is this instance actually a CollectionPersister?booleanisDefinedOnSubclass(int i)Is this property defined on a subclass of the mapped class.booleanisDeleteCallable(int j)booleanisExplicitPolymorphism()Is this class explicit polymorphism only?booleanisIdentifierAssignedByInsert()Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.booleanisInherited()Determine whether the entity is inherited one or more other entities.booleanisInsertCallable(int j)booleanisInstance(java.lang.Object object)Is the given object an instance of this entity?booleanisInstrumented()Has the class actually been bytecode instrumented?protected booleanisInverseSubclassTable(int j)booleanisInverseTable(int j)booleanisLazyPropertiesCacheable()Should lazy properties of this entity be cached?booleanisModifiableEntity(EntityEntry entry)booleanisMultiTable()Is the inheritance hierarchy described by this persister contained across multiple tables?booleanisMutable()Determine whether instances of this entity are considered mutable.booleanisNaturalIdNonNullable()protected booleanisNullableSubclassTable(int j)booleanisNullableTable(int j)booleanisPolymorphic()abstract booleanisPropertyOfTable(int property, int j)booleanisSelectBeforeUpdateRequired()Is select snapshot before update enabled?booleanisSubclassEntityName(java.lang.String entityName)Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.protected booleanisSubclassPropertyDeferred(java.lang.String propertyName, java.lang.String entityName)booleanisSubclassPropertyNullable(int i)Is the numbered property of the class of subclass nullable?protected booleanisSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber, java.util.Set<java.lang.String> treatAsDeclarations)protected booleanisSubclassTableLazy(int j)protected booleanisSubclassTableSequentialSelect(int j)abstract booleanisTableCascadeDeleteEnabled(int j)java.lang.BooleanisTransient(java.lang.Object entity, SharedSessionContractImplementor session)Is this a new transient instance?booleanisUpdateCallable(int j)static booleanisValueGenerationRequired(NonIdentifierAttribute attribute, GenerationTiming matchTiming)booleanisVersioned()Determine whether optimistic locking by column is enabled for this entity.booleanisVersionPropertyGenerated()Does this entity contain a version property that is defined to be database generated?booleanisVersionPropertyInsertable()Is the version property included in insert statements?java.lang.Objectload(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 parameterjava.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session)Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameterjava.lang.Objectload(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, java.lang.Boolean readOnly)java.lang.ObjectloadByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)Load an instance of the persistent class, by a natural id.java.lang.ObjectloadByUniqueKey(java.lang.String propertyName, java.lang.Object uniqueKey, SharedSessionContractImplementor session)Load an instance of the persistent class, by a unique key other than the primary key.java.io.SerializableloadEntityIdByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)Deprecated.voidlock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockMode lockMode, SharedSessionContractImplementor session)Do a version check (optional operation)voidlock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockOptions lockOptions, SharedSessionContractImplementor session)Do a version check (optional operation)protected voidlogStaticSQL()java.util.ListmultiLoad(java.io.Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)Performs a load of multiple entities (of this type) by identifier simultaneously.java.lang.StringoneToManyFilterFragment(java.lang.String alias)java.lang.StringoneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)protected OptimisticLockStyleoptimisticLockStyle()protected voidpostConstruct(Mapping mapping)Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing.voidpostInstantiate()Finish the initialization of this object.protected voidpreInsertInMemoryValueGeneration(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)voidprocessInsertGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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 thePersistenceContext.voidprocessUpdateGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)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 thePersistenceContext.java.lang.StringpropertySelectFragment(java.lang.String tableAlias, java.lang.String suffix, boolean allProperties)Given a query alias and an identifying suffix, render the property select fragment.SelectFragmentpropertySelectFragmentFragment(java.lang.String tableAlias, java.lang.String suffix, boolean allProperties)voidregisterAffectingFetchProfile(java.lang.String fetchProfileName)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.protected java.lang.StringrenderSelect(int[] tableNumbers, int[] columnNumbers, int[] formulaNumbers)voidresetIdentifier(java.lang.Object entity, java.io.Serializable currentId, java.lang.Object currentVersion, SharedSessionContractImplementor session)Set the identifier and version of the given instance back to its "unsaved" value.int[]resolveAttributeIndexes(java.lang.String[] attributeNames)Converts an array of attribute names to a set of indexes, according to the entity metamodelint[]resolveDirtyAttributeIndexes(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.String[] attributeNames, SessionImplementor session)LikeEntityPersister.resolveAttributeIndexes(String[])but also always returns mutable attributesjava.lang.StringselectFragment(java.lang.String alias, java.lang.String suffix)Generate a list of collection index, key and element columnsjava.lang.StringselectFragment(Joinable rhs, java.lang.String rhsAlias, java.lang.String lhsAlias, java.lang.String entitySuffix, java.lang.String collectionSuffix, boolean includeCollectionColumns)All columns to select, when loading.voidsetIdentifier(java.lang.Object entity, java.io.Serializable id, SharedSessionContractImplementor session)Inject the identifier value into the given entity.voidsetPropertyValue(java.lang.Object object, int i, java.lang.Object value)Set the value of a particular propertyvoidsetPropertyValue(java.lang.Object object, java.lang.String propertyName, java.lang.Object value)Set the value of a particular (named) propertyvoidsetPropertyValues(java.lang.Object object, java.lang.Object[] values)Set the given values to the mapped properties of the given objectjava.lang.String[]toColumns(java.lang.String propertyName)Given a property path, return the corresponding column name(s).java.lang.String[]toColumns(java.lang.String name, int i)Given the number of a property of a subclass, and a table alias, return the aliased column names.java.lang.String[]toColumns(java.lang.String alias, java.lang.String propertyName)Obtain aliased column/formula fragments for the specified property path.java.lang.StringtoString()TypetoType(java.lang.String propertyName)Given a component path expression, get the type of the propertyvoidupdate(java.io.Serializable id, java.lang.Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, java.lang.Object[] oldFields, java.lang.Object oldVersion, java.lang.Object object, java.lang.Object rowId, SharedSessionContractImplementor session)Update an objectbooleanupdate(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)voidupdateOrInsert(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)Perform an SQL UPDATE or SQL INSERTprotected booleanuseDynamicInsert()protected booleanuseDynamicUpdate()booleanuseGetGeneratedKeys()booleanuseInsertSelectIdentity()java.lang.StringwhereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)Get the where clause part of any joins (optional operation)java.lang.StringwhereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses, java.util.Set<java.lang.String> treatAsDeclarations)Get the where clause part of any joins (optional operation)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.metadata.ClassMetadata
getIdentifier, getPropertyValuesToInsert, instantiate, setIdentifier
-
Methods inherited from interface org.hibernate.persister.entity.EntityPersister
canIdentityInsertBeDelayed, getFilterAliasGenerator, getPropertySpaces, load
-
Methods inherited from interface org.hibernate.persister.entity.Joinable
getTableName
-
Methods inherited from interface org.hibernate.persister.entity.Loadable
getDiscriminatorType, getDiscriminatorValue, getSubclassForDiscriminatorValue, hydrate
-
Methods inherited from interface org.hibernate.persister.entity.OuterJoinLoadable
fromTableFragment, getPropertyTableName, getSubclassPropertyTableName
-
Methods inherited from interface org.hibernate.persister.entity.Queryable
getConstraintOrderedTableNameClosure, getContraintOrderedTableKeyColumnClosure, getDiscriminatorSQLValue
-
-
-
-
Field Detail
-
ENTITY_CLASS
public static final java.lang.String ENTITY_CLASS
- See Also:
- Constant Field Values
-
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
-
insertResultCheckStyles
protected ExecuteUpdateResultCheckStyle[] insertResultCheckStyles
-
updateResultCheckStyles
protected ExecuteUpdateResultCheckStyle[] updateResultCheckStyles
-
deleteResultCheckStyles
protected ExecuteUpdateResultCheckStyle[] deleteResultCheckStyles
-
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).
-
-
Constructor Detail
-
AbstractEntityPersister
public AbstractEntityPersister(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy, NaturalIdDataAccess naturalIdRegionAccessStrategy, PersisterCreationContext creationContext) throws HibernateException
- Throws:
HibernateException
-
-
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:QueryableGet the name of the table with the given index from the internal array.- Specified by:
getSubclassTableNamein interfaceQueryable- 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) throws MappingException- Throws:
MappingException
-
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:
getDiscriminatorColumnNamein interfaceLoadable- 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:EntityPersisterDetermine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.- Specified by:
isSubclassEntityNamein interfaceEntityPersister- 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.
-
getRootTableKeyColumnNames
public java.lang.String[] getRootTableKeyColumnNames()
Description copied from interface:PostInsertIdentityPersisterThe names of the primary key columns in the root table.- Specified by:
getRootTableKeyColumnNamesin interfacePostInsertIdentityPersister- Returns:
- The primary key column names.
-
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()
-
getInsertResultCheckStyles
public ExecuteUpdateResultCheckStyle[] getInsertResultCheckStyles()
-
getUpdateResultCheckStyles
public ExecuteUpdateResultCheckStyle[] getUpdateResultCheckStyles()
-
getDeleteResultCheckStyles
public ExecuteUpdateResultCheckStyle[] getDeleteResultCheckStyles()
-
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:LoadableDoes the result set contain rowids?
-
getPropertyColumnUpdateable
public boolean[][] getPropertyColumnUpdateable()
-
getPropertyColumnInsertable
public boolean[][] getPropertyColumnInsertable()
-
getPropertySelectable
public boolean[] getPropertySelectable()
-
getTableNames
public java.lang.String[] getTableNames()
-
buildCacheEntryHelper
protected AbstractEntityPersister.CacheEntryHelper buildCacheEntryHelper()
-
canUseReferenceCacheEntries
public boolean canUseReferenceCacheEntries()
- Specified by:
canUseReferenceCacheEntriesin interfaceEntityPersister
-
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:LazyPropertyInitializerInitialize the property, and return its new value.- Specified by:
initializeLazyPropertyin interfaceLazyPropertyInitializer- Parameters:
fieldName- The name of the field being initializedentity- The entity on which the initialization is occurringsession- The session from which the initialization originated.- Returns:
- ?
-
getCollectionKey
protected java.io.Serializable getCollectionKey(CollectionPersister persister, java.lang.Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
-
initializeLazyPropertiesFromDatastore
protected java.lang.Object initializeLazyPropertiesFromDatastore(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session, java.io.Serializable id, EntityEntry entry)
-
initializeLazyPropertiesFromCache
protected java.lang.Object initializeLazyPropertiesFromCache(java.lang.String fieldName, java.lang.Object entity, SharedSessionContractImplementor session, EntityEntry entry, CacheEntry cacheEntry)
-
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()
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRolein interfaceEntityPersister
-
getQuerySpaces
public java.io.Serializable[] getQuerySpaces()
Description copied from interface:EntityPersisterReturns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses. Much likeEntityPersister.getPropertySpaces(), except that here we include subclass entity spaces.- Specified by:
getQuerySpacesin interfaceEntityPersister- Returns:
- The query spaces.
-
isBatchLoadable
public boolean isBatchLoadable()
Description copied from interface:EntityPersisterIs batch loading enabled?- Specified by:
isBatchLoadablein interfaceEntityPersister
-
getIdentifierColumnNames
public java.lang.String[] getIdentifierColumnNames()
Description copied from interface:LoadableGet the names of columns used to persist the identifier- Specified by:
getIdentifierColumnNamesin interfaceLoadable- Specified by:
getIdentifierColumnNamesin interfacePostInsertIdentityPersister- Specified by:
getIdentifierColumnNamesin interfaceQueryable
-
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:LockableFor versioned entities, get the name of the column (again, expected on the root table) used to store the version values.- Specified by:
getVersionColumnNamein interfaceLockable- 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:
isCacheInvalidationRequiredin interfaceEntityPersister
-
isLazyPropertiesCacheable
public boolean isLazyPropertiesCacheable()
Description copied from interface:EntityPersisterShould lazy properties of this entity be cached?- Specified by:
isLazyPropertiesCacheablein interfaceEntityPersister
-
selectFragment
public java.lang.String selectFragment(java.lang.String alias, java.lang.String suffix)Description copied from interface:OuterJoinLoadableGenerate a list of collection index, key and element columns- Specified by:
selectFragmentin interfaceOuterJoinLoadable- Specified by:
selectFragmentin interfaceSQLLoadable
-
getIdentifierAliases
public java.lang.String[] getIdentifierAliases(java.lang.String suffix)
Description copied from interface:LoadableGet the result set aliases used for the identifier columns, given a suffix- Specified by:
getIdentifierAliasesin interfaceLoadable
-
getPropertyAliases
public java.lang.String[] getPropertyAliases(java.lang.String suffix, int i)Description copied from interface:LoadableGet the result set aliases used for the property columns, given a suffix (properties of this class, only).- Specified by:
getPropertyAliasesin interfaceLoadable
-
getDiscriminatorAlias
public java.lang.String getDiscriminatorAlias(java.lang.String suffix)
Description copied from interface:LoadableGet the result set aliases used for the identifier columns, given a suffix- Specified by:
getDiscriminatorAliasin interfaceLoadable
-
identifierSelectFragment
public java.lang.String identifierSelectFragment(java.lang.String name, java.lang.String suffix)Description copied from interface:QueryableGiven a query alias and an identifying suffix, render the identifier select fragment.- Specified by:
identifierSelectFragmentin interfaceQueryable
-
propertySelectFragment
public java.lang.String propertySelectFragment(java.lang.String tableAlias, java.lang.String suffix, boolean allProperties)Description copied from interface:QueryableGiven a query alias and an identifying suffix, render the property select fragment.- Specified by:
propertySelectFragmentin interfaceQueryable
-
propertySelectFragmentFragment
public SelectFragment propertySelectFragmentFragment(java.lang.String tableAlias, java.lang.String suffix, boolean allProperties)
- Specified by:
propertySelectFragmentFragmentin interfaceQueryable
-
getDatabaseSnapshot
public java.lang.Object[] getDatabaseSnapshot(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterGet the current database state of the object, in a "hydrated" form, without resolving identifiers- Specified by:
getDatabaseSnapshotin interfaceEntityPersister- Returns:
- null if there is no row in the database
- Throws:
HibernateException
-
getIdByUniqueKey
public java.io.Serializable getIdByUniqueKey(java.io.Serializable key, java.lang.String uniquePropertyName, SharedSessionContractImplementor session) throws HibernateException- Specified by:
getIdByUniqueKeyin interfaceEntityPersister- Throws:
HibernateException
-
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)
-
concretePropertySelectFragment
protected java.lang.String concretePropertySelectFragment(java.lang.String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)
-
generateSnapshotSelectString
public java.lang.String generateSnapshotSelectString()
-
forceVersionIncrement
public java.lang.Object forceVersionIncrement(java.io.Serializable id, java.lang.Object currentVersion, SharedSessionContractImplementor session)- Specified by:
forceVersionIncrementin interfaceEntityPersister
-
getCurrentVersion
public java.lang.Object getCurrentVersion(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionRetrieve the version number- Specified by:
getCurrentVersionin interfaceEntityPersister- Throws:
HibernateException
-
generateLocker
protected LockingStrategy generateLocker(LockMode lockMode)
-
lock
public void lock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterDo a version check (optional operation)- Specified by:
lockin interfaceEntityPersister- Throws:
HibernateException
-
lock
public void lock(java.io.Serializable id, java.lang.Object version, java.lang.Object object, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterDo a version check (optional operation)- Specified by:
lockin interfaceEntityPersister- Throws:
HibernateException
-
getRootTableName
public java.lang.String getRootTableName()
Description copied from interface:LockableLocks are always applied to the "root table".- Specified by:
getRootTableNamein interfaceLockable- Returns:
- The root table name
-
getRootTableAlias
public java.lang.String getRootTableAlias(java.lang.String drivingAlias)
Description copied from interface:LockableGet the SQL alias this persister would use for the root table given the passed driving alias.- Specified by:
getRootTableAliasin interfaceLockable- 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:LockableGet the names of columns on the root table used to persist the identifier.- Specified by:
getRootTableIdentifierColumnNamesin interfaceLockable- Returns:
- The root table identifier column names.
-
toColumns
public java.lang.String[] toColumns(java.lang.String alias, java.lang.String propertyName) throws QueryExceptionObtain 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:
toColumnsin interfacePropertyMapping- Throws:
QueryException
-
toColumns
public java.lang.String[] toColumns(java.lang.String propertyName) throws QueryExceptionGiven 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:
toColumnsin interfacePropertyMapping- 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:
toTypein interfacePropertyMapping- 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:
getPropertyColumnNamesin interfaceOuterJoinLoadable
-
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:
getSubclassPropertyTableNumberin interfaceQueryable- Parameters:
propertyPath- The name of the property.- Returns:
- The number of the table to which the property is mapped.
-
getSubclassPropertyDeclarer
public Queryable.Declarer getSubclassPropertyDeclarer(java.lang.String propertyPath)
Description copied from interface:QueryableDetermine whether the given property is declared by our mapped class, our super class, or one of our subclasses... Note: the method is called 'subclass property...' simply for consistency sake (e.g.Queryable.getSubclassPropertyTableNumber(java.lang.String)- Specified by:
getSubclassPropertyDeclarerin interfaceQueryable- Parameters:
propertyPath- The property name.- Returns:
- The property declarer
-
getTypeDiscriminatorMetadata
public DiscriminatorMetadata getTypeDiscriminatorMetadata()
Description copied from interface:QueryableRetrieve the information needed to properly deal with this entity's discriminator in a query.- Specified by:
getTypeDiscriminatorMetadatain interfaceQueryable- 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:OuterJoinLoadableGiven the number of a property of a subclass, and a table alias, return the aliased column names.- Specified by:
toColumnsin interfaceOuterJoinLoadable
-
getPropertySubclassNames
protected java.lang.String[] getPropertySubclassNames()
-
getPropertyColumnNames
public java.lang.String[] getPropertyColumnNames(int i)
Description copied from interface:LoadableGet the result set column names mapped for this property (properties of this class, only).- Specified by:
getPropertyColumnNamesin interfaceLoadable
-
getPropertyColumnWriters
public java.lang.String[] getPropertyColumnWriters(int i)
-
getPropertyColumnSpan
public int getPropertyColumnSpan(int i)
-
hasFormulaProperties
public boolean hasFormulaProperties()
-
getFetchMode
public FetchMode getFetchMode(int i)
Description copied from interface:OuterJoinLoadableMay this (subclass closure) property be fetched using an SQL outerjoin?- Specified by:
getFetchModein interfaceOuterJoinLoadable
-
getCascadeStyle
public CascadeStyle getCascadeStyle(int i)
Description copied from interface:OuterJoinLoadableGet the cascade style of this (subclass closure) property- Specified by:
getCascadeStylein interfaceOuterJoinLoadable
-
getSubclassPropertyType
public Type getSubclassPropertyType(int i)
Description copied from interface:OuterJoinLoadableGet the type of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyTypein interfaceOuterJoinLoadable
-
getSubclassPropertyName
public java.lang.String getSubclassPropertyName(int i)
Description copied from interface:OuterJoinLoadableGet the name of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyNamein interfaceOuterJoinLoadable
-
countSubclassProperties
public int countSubclassProperties()
Description copied from interface:OuterJoinLoadableHow many properties are there, for this class and all subclasses?- Specified by:
countSubclassPropertiesin interfaceOuterJoinLoadable
-
getSubclassPropertyColumnNames
public java.lang.String[] getSubclassPropertyColumnNames(int i)
Description copied from interface:OuterJoinLoadableReturn the column names used to persist the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyColumnNamesin interfaceOuterJoinLoadable
-
isDefinedOnSubclass
public boolean isDefinedOnSubclass(int i)
Description copied from interface:OuterJoinLoadableIs this property defined on a subclass of the mapped class.- Specified by:
isDefinedOnSubclassin interfaceOuterJoinLoadable
-
getSubclassPropertyFormulaTemplateClosure
public java.lang.String[][] getSubclassPropertyFormulaTemplateClosure()
- Specified by:
getSubclassPropertyFormulaTemplateClosurein interfaceQueryable
-
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:EntityPersisterConverts an array of attribute names to a set of indexes, according to the entity metamodel- Specified by:
resolveAttributeIndexesin interfaceEntityPersister- Parameters:
attributeNames- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
resolveDirtyAttributeIndexes
public int[] resolveDirtyAttributeIndexes(java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.String[] attributeNames, SessionImplementor session)Description copied from interface:EntityPersisterLikeEntityPersister.resolveAttributeIndexes(String[])but also always returns mutable attributes- Specified by:
resolveDirtyAttributeIndexesin interfaceEntityPersisterattributeNames- 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:SQLLoadableReturn the column alias names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnAliasesin interfaceSQLLoadable
-
getSubclassPropertyColumnNames
public java.lang.String[] getSubclassPropertyColumnNames(java.lang.String propertyName)
Description copied from interface:SQLLoadableReturn the column names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnNamesin interfaceSQLLoadable
-
initSubclassPropertyAliasesMap
protected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException
Must be called by subclasses, at the end of their constructors- Throws:
MappingException
-
getLazyPropertyNumbers
protected int[] getLazyPropertyNumbers()
-
getLazyPropertyNames
protected java.lang.String[] getLazyPropertyNames()
-
getLazyPropertyTypes
protected Type[] getLazyPropertyTypes()
-
getLazyPropertyColumnAliases
protected java.lang.String[][] getLazyPropertyColumnAliases()
-
loadByUniqueKey
public java.lang.Object loadByUniqueKey(java.lang.String propertyName, java.lang.Object uniqueKey, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:UniqueKeyLoadableLoad an instance of the persistent class, by a unique key other than the primary key.- Specified by:
loadByUniqueKeyin interfaceUniqueKeyLoadable- Throws:
HibernateException
-
loadByNaturalId
public java.lang.Object loadByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:UniqueKeyLoadableLoad an instance of the persistent class, by a natural id.- Specified by:
loadByNaturalIdin interfaceUniqueKeyLoadable- Throws:
HibernateException
-
getAppropriateUniqueKeyLoader
protected UniqueEntityLoader getAppropriateUniqueKeyLoader(java.lang.String propertyName, SharedSessionContractImplementor session)
-
getPropertyIndex
public int getPropertyIndex(java.lang.String propertyName)
Description copied from interface:UniqueKeyLoadableGet the property number of the unique key property- Specified by:
getPropertyIndexin interfaceUniqueKeyLoadable
-
createUniqueKeyLoaders
protected void createUniqueKeyLoaders() throws MappingException- Throws:
MappingException
-
createUniqueKeyLoader
protected UniqueEntityLoader createUniqueKeyLoader(Type uniqueKeyType, java.lang.String[] columns, LoadQueryInfluencers loadQueryInfluencers)
-
createNaturalIdLoaders
protected void createNaturalIdLoaders() throws MappingException- Throws:
MappingException
-
getSQLWhereString
protected java.lang.String getSQLWhereString(java.lang.String alias)
-
hasWhere
protected boolean hasWhere()
-
initPropertyPaths
protected void initPropertyPaths(Mapping mapping) throws MappingException
- Throws:
MappingException
-
createEntityLoader
protected UniqueEntityLoader createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers) throws MappingException
- Throws:
MappingException
-
createEntityLoader
protected UniqueEntityLoader createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers) throws MappingException
- Throws:
MappingException
-
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 (seegetLocker(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:
HibernateExceptionjava.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, HibernateExceptionMarshall the fields of a persistent instance to a prepared statement- Throws:
java.sql.SQLExceptionHibernateException
-
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, HibernateExceptionUnmarshal 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:
hydratein interfaceLoadable- Throws:
java.sql.SQLExceptionHibernateException
-
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 HibernateExceptionPerform an SQL INSERT, and then retrieve a generated identifier. This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).- Throws:
HibernateException
-
getIdentitySelectString
public java.lang.String getIdentitySelectString()
Description copied from interface:PostInsertIdentityPersisterGet the database-specific SQL command to retrieve the last generated IDENTITY value.- Specified by:
getIdentitySelectStringin interfacePostInsertIdentityPersister- Returns:
- The SQL command string
-
getSelectByUniqueKeyString
public java.lang.String getSelectByUniqueKeyString(java.lang.String propertyName)
Description copied from interface:PostInsertIdentityPersisterGet a SQL select string that performs a select based on a unique key determined by the given property name).- Specified by:
getSelectByUniqueKeyStringin interfacePostInsertIdentityPersister- 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 HibernateExceptionPerform 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 HibernateExceptionPerform 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
-
delete
public void delete(java.io.Serializable id, java.lang.Object version, int j, java.lang.Object object, java.lang.String sql, SharedSessionContractImplementor session, java.lang.Object[] loadedState) throws HibernateExceptionPerform an SQL DELETE- Throws:
HibernateException
-
getUpdateStrings
protected java.lang.String[] getUpdateStrings(boolean byRowId, boolean lazy)
-
update
public void update(java.io.Serializable id, java.lang.Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, java.lang.Object[] oldFields, java.lang.Object oldVersion, java.lang.Object object, java.lang.Object rowId, SharedSessionContractImplementor session) throws HibernateExceptionUpdate an object- Specified by:
updatein interfaceEntityPersister- Throws:
HibernateException
-
insert
public java.io.Serializable insert(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterPersist an instance, using a natively generated identifier (optional operation)- Specified by:
insertin interfaceEntityPersister- Throws:
HibernateException
-
insert
public void insert(java.io.Serializable id, java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterPersist an instance- Specified by:
insertin interfaceEntityPersister
-
preInsertInMemoryValueGeneration
protected void preInsertInMemoryValueGeneration(java.lang.Object[] fields, java.lang.Object object, SharedSessionContractImplementor session)
-
delete
public void delete(java.io.Serializable id, java.lang.Object version, java.lang.Object object, SharedSessionContractImplementor session) throws HibernateExceptionDelete an object- Specified by:
deletein interfaceEntityPersister- Throws:
HibernateException
-
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 MappingExceptionDescription copied from interface:JoinableGet the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragmentin interfaceJoinable- 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:JoinableGet the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragmentin interfaceJoinable
-
generateFilterConditionAlias
public java.lang.String generateFilterConditionAlias(java.lang.String rootAlias)
Description copied from interface:QueryableThe 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:
generateFilterConditionAliasin interfaceQueryable- 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) throws MappingException- Specified by:
oneToManyFilterFragmentin interfaceJoinable- Throws:
MappingException
-
oneToManyFilterFragment
public java.lang.String oneToManyFilterFragment(java.lang.String alias, java.util.Set<java.lang.String> treatAsDeclarations)- Specified by:
oneToManyFilterFragmentin interfaceJoinable
-
fromJoinFragment
public java.lang.String fromJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)Description copied from interface:JoinableGet the from clause part of any joins (optional operation)- Specified by:
fromJoinFragmentin interfaceJoinable
-
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:JoinableGet the from clause part of any joins (optional operation)- Specified by:
fromJoinFragmentin interfaceJoinable
-
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:JoinableGet the from clause part of any joins (optional operation)- Specified by:
fromJoinFragmentin interfaceJoinable
-
whereJoinFragment
public java.lang.String whereJoinFragment(java.lang.String alias, boolean innerJoin, boolean includeSubclasses)Description copied from interface:JoinableGet the where clause part of any joins (optional operation)- Specified by:
whereJoinFragmentin interfaceJoinable
-
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:JoinableGet the where clause part of any joins (optional operation)- Specified by:
whereJoinFragmentin interfaceJoinable
-
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
-
postInstantiate
public final void postInstantiate() throws MappingExceptionDescription copied from interface:EntityPersisterFinish the initialization of this object.EntityPersister.generateEntityDefinition()must be called for all entity persisters before calling this method. Called only once perSessionFactorylifecycle, after all entity persisters have been instantiated.- Specified by:
postInstantiatein interfaceEntityPersister- Throws:
MappingException- Indicates an issue in the metadata.
-
doPostInstantiate
protected void doPostInstantiate()
-
createLoaders
protected void createLoaders()
-
buildMergeCascadeEntityLoader
protected UniqueEntityLoader buildMergeCascadeEntityLoader(LockMode ignored)
-
buildRefreshCascadeEntityLoader
protected UniqueEntityLoader buildRefreshCascadeEntityLoader(LockMode ignored)
-
getLoaderByLockMode
protected final UniqueEntityLoader getLoaderByLockMode(LockMode lockMode)
-
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:
loadin interfaceEntityPersister
-
load
public java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateExceptionLoad an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter- Specified by:
loadin interfaceEntityPersister- Throws:
HibernateException
-
load
public java.lang.Object load(java.io.Serializable id, java.lang.Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, java.lang.Boolean readOnly) throws HibernateException- Specified by:
loadin interfaceEntityPersister- Throws:
HibernateException
-
initializeEnhancedEntityUsedAsProxy
public java.lang.Object initializeEnhancedEntityUsedAsProxy(java.lang.Object entity, java.lang.String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterCalled fromEnhancementAsProxyLazinessInterceptorto trigger load of the entity's non-lazy state as well as the named attribute we are accessing if it is still uninitialized after fetching non-lazy state- Specified by:
initializeEnhancedEntityUsedAsProxyin interfaceEntityPersister
-
multiLoad
public java.util.List multiLoad(java.io.Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)Description copied from interface:EntityPersisterPerforms a load of multiple entities (of this type) by identifier simultaneously.- Specified by:
multiLoadin interfaceEntityPersister- Parameters:
ids- The identifiers to loadsession- The originating SessionloadOptions- The options for loading- Returns:
- The loaded, matching entities
-
registerAffectingFetchProfile
public void registerAffectingFetchProfile(java.lang.String fetchProfileName)
Description copied from interface:LoadableRegister 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:
registerAffectingFetchProfilein interfaceLoadable- Parameters:
fetchProfileName- The name of the profile affecting this.
-
getAppropriateLoader
protected UniqueEntityLoader getAppropriateLoader(LockOptions lockOptions, SharedSessionContractImplementor session)
-
isAllNull
public final boolean isAllNull(java.lang.Object[] array, int tableNumber)
-
isSubclassPropertyNullable
public boolean isSubclassPropertyNullable(int i)
Description copied from interface:OuterJoinLoadableIs the numbered property of the class of subclass nullable?- Specified by:
isSubclassPropertyNullablein interfaceOuterJoinLoadable
-
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 HibernateExceptionLocate the property-indices of all properties considered to be dirty.- Specified by:
findDirtyin interfaceEntityPersister- 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 HibernateExceptionLocate the property-indices of all properties considered to be dirty.- Specified by:
findModifiedin interfaceEntityPersister- 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!)
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:EntityPersisterReturn the SessionFactory to which this persister "belongs".- Specified by:
getFactoryin interfaceEntityPersister- Returns:
- The owning SessionFactory.
-
getEntityMetamodel
public EntityMetamodel getEntityMetamodel()
Description copied from interface:EntityPersisterRetrieve the underlying entity metamodel instance...- Specified by:
getEntityMetamodelin interfaceEntityPersister- Returns:
- The metamodel
-
canReadFromCache
public boolean canReadFromCache()
- Specified by:
canReadFromCachein interfaceEntityPersister
-
canWriteToCache
public boolean canWriteToCache()
- Specified by:
canWriteToCachein interfaceEntityPersister
-
hasCache
public boolean hasCache()
Description copied from interface:EntityPersisterDoes this class have a cache.- Specified by:
hasCachein interfaceEntityPersister
-
getCacheAccessStrategy
public EntityDataAccess getCacheAccessStrategy()
Description copied from interface:EntityPersisterGet the cache (optional operation)- Specified by:
getCacheAccessStrategyin interfaceEntityPersister
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:EntityPersisterGet the cache structure- Specified by:
getCacheEntryStructurein interfaceEntityPersister
-
buildCacheEntry
public CacheEntry buildCacheEntry(java.lang.Object entity, java.lang.Object[] state, java.lang.Object version, SharedSessionContractImplementor session)
- Specified by:
buildCacheEntryin interfaceEntityPersister
-
hasNaturalIdCache
public boolean hasNaturalIdCache()
Description copied from interface:EntityPersisterDoes this class have a natural id cache- Specified by:
hasNaturalIdCachein interfaceEntityPersister
-
getNaturalIdCacheAccessStrategy
public NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Description copied from interface:EntityPersisterGet the NaturalId cache (optional operation)- Specified by:
getNaturalIdCacheAccessStrategyin interfaceEntityPersister
-
getVersionComparator
public java.util.Comparator getVersionComparator()
-
getEntityName
public final java.lang.String getEntityName()
Description copied from interface:EntityPersisterThe entity name which this persister maps.- Specified by:
getEntityNamein interfaceClassMetadata- Specified by:
getEntityNamein interfaceEntityPersister- Returns:
- The name of the entity which this persister maps.
-
getEntityType
public EntityType getEntityType()
- Specified by:
getEntityTypein interfaceOuterJoinLoadable
-
isPolymorphic
public boolean isPolymorphic()
-
isInherited
public boolean isInherited()
Description copied from interface:EntityPersisterDetermine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.- Specified by:
isInheritedin interfaceClassMetadata- Specified by:
isInheritedin interfaceEntityPersister- Returns:
- True if other entities extend this entity; false otherwise.
-
hasCascades
public boolean hasCascades()
Description copied from interface:EntityPersisterDetermine whether this entity has any non-none cascading.- Specified by:
hasCascadesin interfaceEntityPersister- Returns:
- True if the entity has any properties with a cascade other than NONE; false otherwise (aka, no cascading).
-
hasIdentifierProperty
public boolean hasIdentifierProperty()
Description copied from interface:EntityPersisterDetermine whether the entity has a particular property holding the identifier value.- Specified by:
hasIdentifierPropertyin interfaceClassMetadata- Specified by:
hasIdentifierPropertyin interfaceEntityPersister- Returns:
- True if the entity has a specific property holding identifier value.
-
getVersionType
public VersionType getVersionType()
Description copied from interface:EntityPersisterIfEntityPersister.isVersioned(), then what is the type of the property holding the locking value.- Specified by:
getVersionTypein interfaceEntityPersister- Returns:
- The type of the version property; or null, if not versioned.
-
getVersionProperty
public int getVersionProperty()
Description copied from interface:EntityPersisterIfEntityPersister.isVersioned(), then what is the index of the property holding the locking value.- Specified by:
getVersionPropertyin interfaceClassMetadata- Specified by:
getVersionPropertyin interfaceEntityPersister- Returns:
- The type of the version property; or -66, if not versioned.
-
isVersioned
public boolean isVersioned()
Description copied from interface:EntityPersisterDetermine whether optimistic locking by column is enabled for this entity.- Specified by:
isVersionedin interfaceClassMetadata- Specified by:
isVersionedin interfaceEntityPersister- Returns:
- True if optimistic locking by column (i.e.,
or ) is enabled; false otherwise.
-
isIdentifierAssignedByInsert
public boolean isIdentifierAssignedByInsert()
Description copied from interface:EntityPersisterAre identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.- Specified by:
isIdentifierAssignedByInsertin interfaceEntityPersister- Returns:
- True if identifiers for this entity are generated by the insert execution.
-
hasLazyProperties
public boolean hasLazyProperties()
Description copied from interface:EntityPersisterDetermine whether this entity defines any lazy properties (ala bytecode instrumentation).- Specified by:
hasLazyPropertiesin interfaceEntityPersister- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
afterReassociate
public void afterReassociate(java.lang.Object entity, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterCalled just after the entity has been reassociated with the session- Specified by:
afterReassociatein interfaceEntityPersister
-
isTransient
public java.lang.Boolean isTransient(java.lang.Object entity, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterIs this a new transient instance?- Specified by:
isTransientin interfaceEntityPersister- Throws:
HibernateException
-
hasCollections
public boolean hasCollections()
Description copied from interface:EntityPersisterDetermine whether this entity contains references to persistent collections.- Specified by:
hasCollectionsin interfaceEntityPersister- Returns:
- True if the entity does contain persistent collections; false otherwise.
-
hasMutableProperties
public boolean hasMutableProperties()
Description copied from interface:EntityPersisterDetermine whether any properties of this entity are considered mutable.- Specified by:
hasMutablePropertiesin interfaceEntityPersister- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
-
isMutable
public boolean isMutable()
Description copied from interface:EntityPersisterDetermine whether instances of this entity are considered mutable.- Specified by:
isMutablein interfaceClassMetadata- Specified by:
isMutablein interfaceEntityPersister- Returns:
- True if the entity is considered mutable; false otherwise.
-
isModifiableEntity
public final boolean isModifiableEntity(EntityEntry entry)
-
isAbstract
public boolean isAbstract()
Description copied from interface:QueryableIs this an abstract class?- Specified by:
isAbstractin interfaceLoadable- Specified by:
isAbstractin interfaceQueryable
-
hasSubclasses
public boolean hasSubclasses()
Description copied from interface:LoadableDoes this persistent class have subclasses?- Specified by:
hasSubclassesin interfaceClassMetadata- Specified by:
hasSubclassesin interfaceLoadable
-
hasProxy
public boolean hasProxy()
Description copied from interface:EntityPersisterDetermine whether this entity supports dynamic proxies.- Specified by:
hasProxyin interfaceClassMetadata- Specified by:
hasProxyin interfaceEntityPersister- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
getIdentifierGenerator
public IdentifierGenerator getIdentifierGenerator() throws HibernateException
Description copied from interface:EntityPersisterDetermine which identifier generation strategy is used for this entity.- Specified by:
getIdentifierGeneratorin interfaceEntityPersister- Returns:
- The identifier generation strategy.
- Throws:
HibernateException
-
getIdentityDelegate
@Deprecated public InsertGeneratedIdentifierDelegate getIdentityDelegate()
Deprecated.Exposed for tests only
-
getRootEntityName
public java.lang.String getRootEntityName()
Description copied from interface:EntityPersisterReturns 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:
getRootEntityNamein interfaceEntityPersister- Returns:
- The root entity name.
-
getClassMetadata
public ClassMetadata getClassMetadata()
Description copied from interface:EntityPersisterGet the user-visible metadata for the class (optional operation)- Specified by:
getClassMetadatain interfaceEntityPersister
-
getMappedSuperclass
public java.lang.String getMappedSuperclass()
Description copied from interface:QueryableGet the class that this class is mapped as a subclass of - not necessarily the direct superclass- Specified by:
getMappedSuperclassin interfaceQueryable
-
isExplicitPolymorphism
public boolean isExplicitPolymorphism()
Description copied from interface:QueryableIs this class explicit polymorphism only?- Specified by:
isExplicitPolymorphismin interfaceQueryable
-
useDynamicUpdate
protected boolean useDynamicUpdate()
-
useDynamicInsert
protected boolean useDynamicInsert()
-
hasEmbeddedCompositeIdentifier
public boolean hasEmbeddedCompositeIdentifier()
-
canExtractIdOutOfEntity
public boolean canExtractIdOutOfEntity()
Description copied from interface:EntityPersisterDetermine 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:
canExtractIdOutOfEntityin interfaceEntityPersister- 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:JoinableThe columns to join on- Specified by:
getKeyColumnNamesin interfaceJoinable
-
getName
public java.lang.String getName()
Description copied from interface:JoinableAn identifying name; a class name or collection role name.
-
isCollection
public boolean isCollection()
Description copied from interface:JoinableIs this instance actually a CollectionPersister?- Specified by:
isCollectionin interfaceJoinable
-
consumesEntityAlias
public boolean consumesEntityAlias()
Description copied from interface:JoinableVery, very, very ugly...- Specified by:
consumesEntityAliasin interfaceJoinable- Returns:
- Does this persister "consume" entity column aliases in the result set?
-
consumesCollectionAlias
public boolean consumesCollectionAlias()
Description copied from interface:JoinableVery, very, very ugly...- Specified by:
consumesCollectionAliasin interfaceJoinable- 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:
getPropertyTypein interfaceClassMetadata- Specified by:
getPropertyTypein interfaceEntityPersister- Parameters:
propertyName- The name of the property for which to retrieve the type.- Returns:
- The type.
- Throws:
MappingException- Typically indicates an unknown property name.
-
getType
public Type getType()
Description copied from interface:PropertyMappingGet the type of the thing containing the properties- Specified by:
getTypein interfacePropertyMapping- Specified by:
getTypein interfaceSQLLoadable
-
isSelectBeforeUpdateRequired
public boolean isSelectBeforeUpdateRequired()
Description copied from interface:EntityPersisterIs select snapshot before update enabled?- Specified by:
isSelectBeforeUpdateRequiredin interfaceEntityPersister
-
optimisticLockStyle
protected final OptimisticLockStyle optimisticLockStyle()
-
createProxy
public java.lang.Object createProxy(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterCreate a new proxy instance- Specified by:
createProxyin interfaceEntityPersister- Throws:
HibernateException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.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:JoinableAll columns to select, when loading.- Specified by:
selectFragmentin interfaceJoinable
-
isInstrumented
public boolean isInstrumented()
Description copied from interface:EntityPersisterHas the class actually been bytecode instrumented?- Specified by:
isInstrumentedin interfaceEntityPersister
-
hasInsertGeneratedProperties
public boolean hasInsertGeneratedProperties()
Description copied from interface:EntityPersisterDoes this entity define any properties as being database generated on insert?- Specified by:
hasInsertGeneratedPropertiesin interfaceEntityPersister- 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:EntityPersisterDoes this entity define any properties as being database generated on update?- Specified by:
hasUpdateGeneratedPropertiesin interfaceEntityPersister- 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:EntityPersisterDoes this entity contain a version property that is defined to be database generated?- Specified by:
isVersionPropertyGeneratedin interfaceEntityPersister- 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:QueryableIs the version property included in insert statements?- Specified by:
isVersionPropertyInsertablein interfaceQueryable
-
afterInitialize
public void afterInitialize(java.lang.Object entity, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterCalled just after the entities properties have been initialized- Specified by:
afterInitializein interfaceEntityPersister
-
getPropertyNames
public java.lang.String[] getPropertyNames()
Description copied from interface:EntityPersisterGet the names of the class properties - doesn't have to be the names of the actual Java properties (used for XML generation only)- Specified by:
getPropertyNamesin interfaceClassMetadata- Specified by:
getPropertyNamesin interfaceEntityPersister
-
getPropertyTypes
public Type[] getPropertyTypes()
Description copied from interface:EntityPersisterGet the Hibernate types of the class properties- Specified by:
getPropertyTypesin interfaceClassMetadata- Specified by:
getPropertyTypesin interfaceEntityPersister
-
getPropertyLaziness
public boolean[] getPropertyLaziness()
Description copied from interface:ClassMetadataGet the "laziness" of the properties of this class- Specified by:
getPropertyLazinessin interfaceClassMetadata- Specified by:
getPropertyLazinessin interfaceEntityPersister
-
getPropertyUpdateability
public boolean[] getPropertyUpdateability()
Description copied from interface:EntityPersisterGet the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)- Specified by:
getPropertyUpdateabilityin interfaceEntityPersister
-
getPropertyCheckability
public boolean[] getPropertyCheckability()
Description copied from interface:EntityPersisterGet the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)- Specified by:
getPropertyCheckabilityin interfaceEntityPersister
-
getNonLazyPropertyUpdateability
public boolean[] getNonLazyPropertyUpdateability()
-
getPropertyInsertability
public boolean[] getPropertyInsertability()
Description copied from interface:EntityPersisterGet the "insertability" of the properties of this class (does the property appear in an SQL INSERT)- Specified by:
getPropertyInsertabilityin interfaceEntityPersister
-
getPropertyInsertGenerationInclusions
@Deprecated public ValueInclusion[] getPropertyInsertGenerationInclusions()
Deprecated.no simple, direct replacementDescription copied from interface:EntityPersisterWhich of the properties of this class are database generated values on insert?- Specified by:
getPropertyInsertGenerationInclusionsin interfaceEntityPersister
-
getPropertyUpdateGenerationInclusions
@Deprecated public ValueInclusion[] getPropertyUpdateGenerationInclusions()
Deprecated.no simple, direct replacementDescription copied from interface:EntityPersisterWhich of the properties of this class are database generated values on update?- Specified by:
getPropertyUpdateGenerationInclusionsin interfaceEntityPersister
-
getPropertyNullability
public boolean[] getPropertyNullability()
Description copied from interface:EntityPersisterGet the nullability of the properties of this class- Specified by:
getPropertyNullabilityin interfaceClassMetadata- Specified by:
getPropertyNullabilityin interfaceEntityPersister
-
getPropertyVersionability
public boolean[] getPropertyVersionability()
Description copied from interface:EntityPersisterGet the "versionability" of the properties of this class (is the property optimistic-locked)- Specified by:
getPropertyVersionabilityin interfaceEntityPersister
-
getPropertyCascadeStyles
public CascadeStyle[] getPropertyCascadeStyles()
Description copied from interface:EntityPersisterGet the cascade styles of the properties (optional operation)- Specified by:
getPropertyCascadeStylesin interfaceEntityPersister
-
getMappedClass
public final java.lang.Class getMappedClass()
Description copied from interface:EntityPersisterThe persistent class, or null- Specified by:
getMappedClassin interfaceClassMetadata- Specified by:
getMappedClassin interfaceEntityPersister
-
implementsLifecycle
public boolean implementsLifecycle()
Description copied from interface:EntityPersisterDoes the class implement theLifecycleinterface.- Specified by:
implementsLifecyclein interfaceClassMetadata- Specified by:
implementsLifecyclein interfaceEntityPersister
-
getConcreteProxyClass
public java.lang.Class getConcreteProxyClass()
Description copied from interface:EntityPersisterGet the proxy interface that instances of this concrete class will be cast to (optional operation).- Specified by:
getConcreteProxyClassin interfaceEntityPersister
-
setPropertyValues
public void setPropertyValues(java.lang.Object object, java.lang.Object[] values)Description copied from interface:EntityPersisterSet the given values to the mapped properties of the given object- Specified by:
setPropertyValuesin interfaceClassMetadata- Specified by:
setPropertyValuesin interfaceEntityPersister
-
setPropertyValue
public void setPropertyValue(java.lang.Object object, int i, java.lang.Object value)Description copied from interface:EntityPersisterSet the value of a particular property- Specified by:
setPropertyValuein interfaceEntityPersister
-
getPropertyValues
public java.lang.Object[] getPropertyValues(java.lang.Object object)
Description copied from interface:EntityPersisterReturn the (loaded) values of the mapped properties of the object (not including backrefs)- Specified by:
getPropertyValuesin interfaceClassMetadata- Specified by:
getPropertyValuesin interfaceEntityPersister- 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:EntityPersisterGet the value of a particular property- Specified by:
getPropertyValuein interfaceEntityPersister
-
getPropertyValue
public java.lang.Object getPropertyValue(java.lang.Object object, java.lang.String propertyName)Description copied from interface:EntityPersisterGet the value of a particular property- Specified by:
getPropertyValuein interfaceClassMetadata- Specified by:
getPropertyValuein interfaceEntityPersister
-
getIdentifier
public java.io.Serializable getIdentifier(java.lang.Object object)
Description copied from interface:EntityPersisterGet the identifier of an instance (throw an exception if no identifier property)- Specified by:
getIdentifierin interfaceClassMetadata- Specified by:
getIdentifierin interfaceEntityPersister
-
getIdentifier
public java.io.Serializable getIdentifier(java.lang.Object entity, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterGet the identifier of an instance (throw an exception if no identifier property)- Specified by:
getIdentifierin interfaceClassMetadata- Specified by:
getIdentifierin interfaceEntityPersister- Parameters:
entity- The entity for which to get the identifiersession- 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:EntityPersisterInject the identifier value into the given entity.- Specified by:
setIdentifierin interfaceClassMetadata- Specified by:
setIdentifierin interfaceEntityPersister- 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:EntityPersisterGet the version number (or timestamp) from the object's version property (or return null if not versioned)- Specified by:
getVersionin interfaceClassMetadata- Specified by:
getVersionin interfaceEntityPersister
-
instantiate
public java.lang.Object instantiate(java.io.Serializable id, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterCreate a class instance initialized with the given identifier- Specified by:
instantiatein interfaceClassMetadata- Specified by:
instantiatein interfaceEntityPersister- 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:EntityPersisterIs the given object an instance of this entity?- Specified by:
isInstancein interfaceEntityPersister
-
hasUninitializedLazyProperties
public boolean hasUninitializedLazyProperties(java.lang.Object object)
Description copied from interface:EntityPersisterDoes the given instance have any uninitialized lazy properties?- Specified by:
hasUninitializedLazyPropertiesin interfaceEntityPersister
-
resetIdentifier
public void resetIdentifier(java.lang.Object entity, java.io.Serializable currentId, java.lang.Object currentVersion, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterSet the identifier and version of the given instance back to its "unsaved" value.- Specified by:
resetIdentifierin interfaceEntityPersister- Parameters:
entity- The entity instancecurrentId- 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:EntityPersisterA 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:
getSubclassEntityPersisterin interfaceEntityPersister- Parameters:
instance- The entity instancefactory- Reference to the SessionFactory- Returns:
- The appropriate persister
-
isMultiTable
public boolean isMultiTable()
Description copied from interface:QueryableIs the inheritance hierarchy described by this persister contained across multiple tables?- Specified by:
isMultiTablein interfaceQueryable- Returns:
- True if the inheritance hierarchy is spread across multiple tables; false otherwise.
-
getPropertySpan
public int getPropertySpan()
-
getPropertyValuesToInsert
public java.lang.Object[] getPropertyValuesToInsert(java.lang.Object object, java.util.Map mergeMap, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterReturn the values of the insertable properties of the object (including backrefs)- Specified by:
getPropertyValuesToInsertin interfaceClassMetadata- Specified by:
getPropertyValuesToInsertin interfaceEntityPersister- Throws:
HibernateException
-
processInsertGeneratedProperties
public void processInsertGeneratedProperties(java.io.Serializable id, java.lang.Object entity, java.lang.Object[] state, SharedSessionContractImplementor session)Description copied from interface:EntityPersisterPerform 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 thePersistenceContext. 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:
processInsertGeneratedPropertiesin interfaceEntityPersister- 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:EntityPersisterPerform 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 thePersistenceContext. 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:
processUpdateGeneratedPropertiesin interfaceEntityPersister- Parameters:
id- The entity's id value.entity- The entity for which to get the state.session- The session
-
isValueGenerationRequired
public static boolean isValueGenerationRequired(NonIdentifierAttribute attribute, GenerationTiming matchTiming)
-
getIdentifierPropertyName
public java.lang.String getIdentifierPropertyName()
Description copied from interface:EntityPersisterGet the name of the identifier property (or return null) - need not return the name of an actual Java property- Specified by:
getIdentifierPropertyNamein interfaceClassMetadata- Specified by:
getIdentifierPropertyNamein interfaceEntityPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:EntityPersisterGet the identifier type- Specified by:
getIdentifierTypein interfaceClassMetadata- Specified by:
getIdentifierTypein interfaceEntityPersister
-
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections()
Description copied from interface:EntityPersisterDetermine whether this entity contains references to persistent collections which are fetchable by subselect?- Specified by:
hasSubselectLoadableCollectionsin interfaceEntityPersister- Returns:
- True if the entity contains collections fetchable by subselect; false otherwise.
-
getNaturalIdentifierProperties
public int[] getNaturalIdentifierProperties()
Description copied from interface:EntityPersisterIf the entity defines a natural id (EntityPersister.hasNaturalIdentifier()), which properties make up the natural id.- Specified by:
getNaturalIdentifierPropertiesin interfaceClassMetadata- Specified by:
getNaturalIdentifierPropertiesin interfaceEntityPersister- Returns:
- The indices of the properties making of the natural id; or null, if no natural id is defined.
-
getNaturalIdentifierSnapshot
public java.lang.Object[] getNaturalIdentifierSnapshot(java.io.Serializable id, SharedSessionContractImplementor session) throws HibernateExceptionDescription copied from interface:EntityPersisterRetrieve the current state of the natural-id properties from the database.- Specified by:
getNaturalIdentifierSnapshotin interfaceEntityPersister- Parameters:
id- The identifier of the entity for which to retrieve the natural-id values.session- The session from which the request originated.- Returns:
- The natural-id snapshot.
- Throws:
HibernateException
-
loadEntityIdByNaturalId
@Deprecated public java.io.Serializable loadEntityIdByNaturalId(java.lang.Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)Deprecated.Description copied from interface:EntityPersisterLoad the id for the entity based on the natural id.- Specified by:
loadEntityIdByNaturalIdin interfaceEntityPersister
-
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)
-
hasNaturalIdentifier
public boolean hasNaturalIdentifier()
Description copied from interface:EntityPersisterDetermine whether this entity defines a natural identifier.- Specified by:
hasNaturalIdentifierin interfaceClassMetadata- Specified by:
hasNaturalIdentifierin interfaceEntityPersister- Returns:
- True if the entity defines a natural id; false otherwise.
-
setPropertyValue
public void setPropertyValue(java.lang.Object object, java.lang.String propertyName, java.lang.Object value)Description copied from interface:ClassMetadataSet the value of a particular (named) property- Specified by:
setPropertyValuein interfaceClassMetadata
-
getTableId
public static int getTableId(java.lang.String tableName, java.lang.String[] tables)
-
getEntityMode
public EntityMode getEntityMode()
- Specified by:
getEntityModein interfaceEntityPersister
-
getEntityTuplizer
public EntityTuplizer getEntityTuplizer()
- Specified by:
getEntityTuplizerin interfaceEntityPersister
-
getInstrumentationMetadata
public BytecodeEnhancementMetadata getInstrumentationMetadata()
- Specified by:
getInstrumentationMetadatain interfaceEntityPersister
-
getBytecodeEnhancementMetadata
public BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
- Specified by:
getBytecodeEnhancementMetadatain interfaceEntityPersister
-
getTableAliasForColumn
public java.lang.String getTableAliasForColumn(java.lang.String columnName, java.lang.String rootAlias)Description copied from interface:LoadableGiven 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 isJoinedSubclassEntityPersister- Specified by:
getTableAliasForColumnin interfaceLoadable- Parameters:
columnName- The column namerootAlias- 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)
-
getEntityEntryFactory
public EntityEntryFactory getEntityEntryFactory()
Description copied from interface:EntityPersisterGet the EntityEntryFactory indicated for the entity mapped by this persister.- Specified by:
getEntityEntryFactoryin interfaceEntityPersister- Returns:
- The proper EntityEntryFactory.
-
generateEntityDefinition
public void generateEntityDefinition()
Description copied from interface:EntityPersisterGenerate the entity definition for this object. This must be done for all entity persisters before callingEntityPersister.postInstantiate().- Specified by:
generateEntityDefinitionin interfaceEntityPersister
-
getEntityPersister
public EntityPersister getEntityPersister()
- Specified by:
getEntityPersisterin interfaceEntityDefinition
-
getEntityKeyDefinition
public EntityIdentifierDefinition getEntityKeyDefinition()
- Specified by:
getEntityKeyDefinitionin interfaceEntityDefinition
-
getAttributes
public java.lang.Iterable<AttributeDefinition> getAttributes()
- Specified by:
getAttributesin interfaceAttributeSource
-
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()
-
-