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 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 interface
AbstractEntityPersister.CacheEntryHelper
Consolidated these onto a single helper because the 2 pieces work in tandem.protected static interface
AbstractEntityPersister.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 int
batchSize
protected String[]
customSQLDelete
protected String[]
customSQLInsert
protected String[]
customSQLUpdate
protected boolean[]
deleteCallable
protected ExecuteUpdateResultCheckStyle[]
deleteResultCheckStyles
static String
ENTITY_CLASS
protected boolean[]
insertCallable
protected ExecuteUpdateResultCheckStyle[]
insertResultCheckStyles
protected BasicEntityPropertyMapping
propertyMapping
Warning: When there are duplicated property names in the subclasses then propertyMapping will only contain one of those properties.protected String
rowIdName
protected boolean[]
updateCallable
protected ExecuteUpdateResultCheckStyle[]
updateResultCheckStyles
static String
VERSION_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 void
addDiscriminatorToInsert(Insert insert)
protected void
addDiscriminatorToSelect(SelectFragment select, String name, String suffix)
void
afterInitialize(Object entity, SharedSessionContractImplementor session)
Called just after the entities properties have been initializedvoid
afterReassociate(Object entity, SharedSessionContractImplementor session)
Called just after the entity has been reassociated with the sessionCacheEntry
buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
protected AbstractEntityPersister.CacheEntryHelper
buildCacheEntryHelper()
boolean
canExtractIdOutOfEntity()
Determine whether detached instances of this entity carry their own identifier value.boolean
canReadFromCache()
boolean
canUseReferenceCacheEntries()
boolean
canWriteToCache()
protected boolean
check(int rows, Serializable id, int tableNumber, Expectation expectation, PreparedStatement statement)
protected boolean
checkVersion(boolean[] includeProperty)
protected String
concretePropertySelectFragment(String alias, boolean[] includeProperty)
protected String
concretePropertySelectFragment(String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)
protected String
concretePropertySelectFragmentSansLeadingComma(String alias, boolean[] include)
boolean
consumesCollectionAlias()
Very, very, very ugly...boolean
consumesEntityAlias()
Very, very, very ugly...int
countSubclassProperties()
How many properties are there, for this class and all subclasses?protected UniqueEntityLoader
createEntityLoader(LockMode lockMode)
Used internally to create static loaders.protected UniqueEntityLoader
createEntityLoader(LockMode lockMode, LoadQueryInfluencers loadQueryInfluencers)
protected UniqueEntityLoader
createEntityLoader(LockOptions lockOptions, LoadQueryInfluencers loadQueryInfluencers)
protected String
createFrom(int tableNumber, String alias)
protected JoinFragment
createJoin(int[] tableNumbers, String drivingAlias)
protected JoinFragment
createJoin(String name, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
protected void
createLoaders()
Object
createProxy(Serializable id, SharedSessionContractImplementor session)
Create a new proxy instanceprotected void
createQueryLoader()
protected SelectFragment
createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
protected void
createUniqueKeyLoaders()
protected String
createWhereByKey(int tableNumber, String alias)
protected int
dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement st, SharedSessionContractImplementor session, boolean isUpdate)
protected int
dehydrate(Serializable id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SharedSessionContractImplementor session, int index, boolean isUpdate)
Marshall the fields of a persistent instance to a prepared statementprotected void
delete(Serializable id, Object version, int j, Object object, String sql, SharedSessionContractImplementor session, Object[] loadedState)
Perform an SQL DELETEvoid
delete(Serializable id, Object version, Object object, SharedSessionContractImplementor session)
Delete an objectprotected JoinType
determineSubclassTableJoinType(int subclassTableNumber, boolean canInnerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
protected String
determineTableName(Table table, JdbcEnvironment jdbcEnvironment)
int
determineTableNumberForColumn(String columnName)
protected void
doPostInstantiate()
protected abstract String
filterFragment(String alias)
String
filterFragment(String alias, Map enabledFilters)
Get the where clause filter, given a query alias and considering enabled session filtersString
filterFragment(String alias, Map enabledFilters, Set<String> treatAsDeclarations)
Get the where clause filter, given a query alias and considering enabled session filtersprotected abstract String
filterFragment(String alias, Set<String> treatAsDeclarations)
int[]
findDirty(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session)
Locate the property-indices of all properties considered to be dirty.int[]
findModified(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session)
Locate the property-indices of all properties considered to be dirty.Object
forceVersionIncrement(Serializable id, Object currentVersion, SharedSessionContractImplementor session)
String
fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the from clause part of any joins (optional operation)String
fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
Get the from clause part of any joins (optional operation)protected String
generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version)void
generateEntityDefinition()
Generate the entity definition for this object.String
generateFilterConditionAlias(String rootAlias)
The alias used for any filter conditions (mapped where-fragments or enabled-filters).protected String
generateIdByUniqueKeySelectString(String uniquePropertyName)
protected String
generateIdentityInsertString(boolean[] includeProperty)
Used to generate an insery statement against the root table in the case of identifier generation strategies where the insert statement executions actually generates the identifier value.protected String
generateInsertGeneratedValuesSelectString()
protected String
generateInsertString(boolean[] includeProperty, int j)
protected String
generateInsertString(boolean identityInsert, boolean[] includeProperty)
protected String
generateInsertString(boolean identityInsert, boolean[] includeProperty, int j)
Generate the SQL that inserts a rowprotected Map<String,String>
generateLazySelectStringsByFetchGroup()
protected LockingStrategy
generateLocker(LockMode lockMode)
protected String
generateSelectVersionString()
Generate the SQL that selects the version number by idprotected String
generateSnapshotSelectString()
static String
generateTableAlias(String rootAlias, int tableNumber)
protected String
generateUpdateGeneratedValuesSelectString()
protected String
generateUpdateString(boolean[] includeProperty, int j, boolean useRowId)
protected String
generateUpdateString(boolean[] includeProperty, int j, Object[] oldFields, boolean useRowId)
Generate the SQL that updates a row by id (and version)protected UniqueEntityLoader
getAppropriateLoader(LockOptions lockOptions, SharedSessionContractImplementor session)
Iterable<AttributeDefinition>
getAttributes()
BytecodeEnhancementMetadata
getBytecodeEnhancementMetadata()
EntityDataAccess
getCacheAccessStrategy()
Get the cache (optional operation)CacheEntryStructure
getCacheEntryStructure()
Get the cache structureCascadeStyle
getCascadeStyle(int i)
Get the cascade style of this (subclass closure) propertyClassMetadata
getClassMetadata()
Get the user-visible metadata for the class (optional operation)protected Serializable
getCollectionKey(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
Class
getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation).Object
getCurrentVersion(Serializable id, SharedSessionContractImplementor session)
Retrieve the version numberObject[]
getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session)
Get the current database state of the object, in a "hydrated" form, without resolving identifiersprotected String
getDiscriminatorAlias()
String
getDiscriminatorAlias(String suffix)
Get the result set aliases used for the identifier columns, given a suffixString
getDiscriminatorColumnName()
String
getDiscriminatorColumnReaders()
String
getDiscriminatorColumnReaderTemplate()
protected String
getDiscriminatorFormulaTemplate()
EntityEntryFactory
getEntityEntryFactory()
Get the EntityEntryFactory indicated for the entity mapped by this persister.EntityIdentifierDefinition
getEntityKeyDefinition()
EntityMetamodel
getEntityMetamodel()
Retrieve the underlying entity metamodel instance...EntityMode
getEntityMode()
String
getEntityName()
The entity name which this persister maps.EntityPersister
getEntityPersister()
EntityTuplizer
getEntityTuplizer()
EntityType
getEntityType()
SessionFactoryImplementor
getFactory()
Return the SessionFactory to which this persister "belongs".FetchMode
getFetchMode(int i)
May this (subclass closure) property be fetched using an SQL outerjoin?Serializable
getIdByUniqueKey(Serializable key, String uniquePropertyName, SharedSessionContractImplementor session)
Serializable
getIdentifier(Object object)
Get the identifier of an instance (throw an exception if no identifier property)Serializable
getIdentifier(Object entity, SharedSessionContractImplementor session)
Get the identifier of an instance (throw an exception if no identifier property)protected String[]
getIdentifierAliases()
String[]
getIdentifierAliases(String suffix)
Get the result set aliases used for the identifier columns, given a suffixString[]
getIdentifierColumnNames()
Get the names of columns used to persist the identifierString[]
getIdentifierColumnReaders()
String[]
getIdentifierColumnReaderTemplates()
protected int
getIdentifierColumnSpan()
IdentifierGenerator
getIdentifierGenerator()
Determine which identifier generation strategy is used for this entity.String
getIdentifierPropertyName()
Get the name of the identifier property (or return null) - need not return the name of an actual Java propertyType
getIdentifierType()
Get the identifier typeString
getIdentitySelectString()
Get the database-specific SQL command to retrieve the last generated IDENTITY value.BytecodeEnhancementMetadata
getInstrumentationMetadata()
String[]
getKeyColumnNames()
The columns to join onprotected abstract String[]
getKeyColumns(int j)
protected UniqueEntityLoader
getLoaderByLockMode(LockMode lockMode)
protected Map
getLoaders()
Deprecated.Because there are better patterns for thisClass
getMappedClass()
The persistent class, or nullString
getMappedSuperclass()
Get the class that this class is mapped as a subclass of - not necessarily the direct superclassString
getName()
An identifying name; a class name or collection role name.NaturalIdDataAccess
getNaturalIdCacheAccessStrategy()
Get the NaturalId cache (optional operation)int[]
getNaturalIdentifierProperties()
If the entity defines a natural id (EntityPersister.hasNaturalIdentifier()
), which properties make up the natural id.Object[]
getNaturalIdentifierSnapshot(Serializable id, SharedSessionContractImplementor session)
Retrieve the current state of the natural-id properties from the database.NavigableRole
getNavigableRole()
boolean[]
getNonLazyPropertyUpdateability()
String[][]
getPolymorphicJoinColumns(String lhsTableAlias, String propertyPath)
protected boolean[]
getPropertiesToInsert(Object[] fields)
Transform the array of property indexes to an array of booleans, true when the property is insertable and non-nullprotected boolean[]
getPropertiesToUpdate(int[] dirtyProperties, boolean hasDirtyCollection)
Transform the array of property indexes to an array of booleans, true when the property is dirtyString[]
getPropertyAliases(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)protected boolean[][]
getPropertyColumnInsertable()
String[]
getPropertyColumnNames(int i)
Get the result set column names mapped for this property (properties of this class, only).String[]
getPropertyColumnNames(String propertyName)
Get the column names for the given property pathprotected int
getPropertyColumnSpan(int i)
protected boolean[][]
getPropertyColumnUpdateable()
String[]
getPropertyColumnWriters(int i)
int
getPropertyIndex(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 classString[]
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 classprotected boolean[]
getPropertySelectable()
protected int
getPropertySpan()
protected String[]
getPropertySubclassNames()
protected abstract int[]
getPropertyTableNumbers()
protected abstract int[]
getPropertyTableNumbersInSelect()
Type
getPropertyType(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)protected boolean[]
getPropertyUpdateability(Object entity)
Which properties appear in the SQL update? (Initialized, updateable ones!)ValueInclusion[]
getPropertyUpdateGenerationInclusions()
Deprecated.no simple, direct replacementObject
getPropertyValue(Object object, int i)
Get the value of a particular propertyObject
getPropertyValue(Object object, String propertyName)
Get the value of a particular propertyObject[]
getPropertyValues(Object object)
Return the (loaded) values of the mapped properties of the object (not including backrefs)Object[]
getPropertyValuesToInsert(Object object, 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)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.String
getRootEntityName()
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique.String
getRootTableAlias(String drivingAlias)
Get the SQL alias this persister would use for the root table given the passed driving alias.String[]
getRootTableIdentifierColumnNames()
Get the names of columns on the root table used to persist the identifier.String[]
getRootTableKeyColumnNames()
The names of the primary key columns in the root table.String
getRootTableName()
Locks are always applied to the "root table".String
getSelectByUniqueKeyString(String propertyName)
Get a SQL select string that performs a select based on a unique key determined by the given property name).protected String
getSequentialSelect(String entityName)
protected String[]
getSQLDeleteStrings()
protected String
getSQLIdentityInsertString()
The query that inserts a row, letting the database generate an idprotected String[]
getSQLInsertStrings()
protected String
getSQLLazySelectString(String fetchGroup)
protected String[]
getSQLLazyUpdateByRowIdStrings()
protected String[]
getSQLLazyUpdateStrings()
protected String
getSQLSnapshotSelectString()
protected String[]
getSQLUpdateByRowIdStrings()
protected String[]
getSQLUpdateStrings()
protected String
getSQLWhereString(String alias)
protected String[]
getSubclassColumnAliasClosure()
protected String[]
getSubclassColumnClosure()
protected boolean[]
getSubclassColumnLazyiness()
String[]
getSubclassColumnReaderTemplateClosure()
protected abstract int[]
getSubclassColumnTableNumberClosure()
EntityPersister
getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory)
A request has already identified the entity-name of this persister as the mapping for the given instance.protected String[]
getSubclassFormulaAliasClosure()
protected String[]
getSubclassFormulaClosure()
protected boolean[]
getSubclassFormulaLazyiness()
protected abstract int[]
getSubclassFormulaTableNumberClosure()
protected String[]
getSubclassFormulaTemplateClosure()
String[]
getSubclassPropertyColumnAliases(String propertyName, String suffix)
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).protected String[][]
getSubclassPropertyColumnNameClosure()
String[]
getSubclassPropertyColumnNames(int i)
Return the column names used to persist the numbered property of the class or a subclass.String[]
getSubclassPropertyColumnNames(String propertyName)
Return the column names used to persist/query the named property of the class or a subclass (optional operation).String[][]
getSubclassPropertyColumnReaderClosure()
String[][]
getSubclassPropertyColumnReaderTemplateClosure()
Queryable.Declarer
getSubclassPropertyDeclarer(String propertyPath)
Determine whether the given property is declared by our mapped class, our super class, or one of our subclasses...String[][]
getSubclassPropertyFormulaTemplateClosure()
String
getSubclassPropertyName(int i)
Get the name of the numbered property of the class or a subclass.protected String[]
getSubclassPropertyNameClosure()
protected String[]
getSubclassPropertySubclassNameClosure()
protected abstract int
getSubclassPropertyTableNumber(int i)
int
getSubclassPropertyTableNumber(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.Type
getSubclassPropertyType(int i)
Get the type of the numbered property of the class or a subclass.protected Type[]
getSubclassPropertyTypeClosure()
protected abstract String[]
getSubclassTableKeyColumns(int j)
abstract String
getSubclassTableName(int j)
Get the name of the table with the given index from the internal array.abstract int
getSubclassTableSpan()
String
getTableAliasForColumn(String columnName, 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 int
getTableId(String tableName, String[] tables)
protected abstract String
getTableName(int j)
protected abstract int
getTableSpan()
protected boolean[]
getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)
Decide which tables need to be updated.protected static String
getTemplateFromString(String string, SessionFactoryImplementor factory)
Type
getType()
Get the type of the thing containing the propertiesDiscriminatorMetadata
getTypeDiscriminatorMetadata()
Retrieve the information needed to properly deal with this entity's discriminator in a query.Object
getVersion(Object object)
Get the version number (or timestamp) from the object's version property (or return null if not versioned)String
getVersionColumnName()
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.Comparator
getVersionComparator()
protected String
getVersionedTableName()
int
getVersionProperty()
IfEntityPersister.isVersioned()
, then what is the index of the property holding the locking value.protected String
getVersionSelectString()
VersionType
getVersionType()
IfEntityPersister.isVersioned()
, then what is the type of the property holding the locking value.boolean
hasCache()
Does this class have a cache.boolean
hasCascades()
Determine whether this entity has any non-none cascading.boolean
hasCollections()
Determine whether this entity contains references to persistent collections.protected boolean
hasEmbeddedCompositeIdentifier()
protected boolean
hasFormulaProperties()
boolean
hasIdentifierProperty()
Determine whether the entity has a particular property holding the identifier value.boolean
hasInsertGeneratedProperties()
Does this entity define any properties as being database generated on insert?boolean
hasLazyProperties()
Determine whether this entity defines any lazy properties (ala bytecode instrumentation).boolean
hasMutableProperties()
Determine whether any properties of this entity are considered mutable.boolean
hasNaturalIdCache()
Does this class have a natural id cacheboolean
hasNaturalIdentifier()
Determine whether this entity defines a natural identifier.boolean
hasProxy()
Determine whether this entity supports dynamic proxies.boolean
hasRowId()
Does the result set contain rowids?boolean
hasSequentialSelect()
boolean
hasSubclasses()
Does this persistent class have subclasses?boolean
hasSubselectLoadableCollections()
Determine whether this entity contains references to persistent collections which are fetchable by subselect?boolean
hasUninitializedLazyProperties(Object object)
Does the given instance have any uninitialized lazy properties?boolean
hasUpdateGeneratedProperties()
Does this entity define any properties as being database generated on update?protected boolean
hasWhere()
Object[]
hydrate(ResultSet rs, Serializable id, Object object, Loadable rootLoadable, String[][] suffixedPropertyColumns, boolean allProperties, SharedSessionContractImplementor session)
Unmarshall the fields of a persistent instance from a result set, without resolving associations or collections.String
identifierSelectFragment(String name, String suffix)
Given a query alias and an identifying suffix, render the identifier select fragment.boolean
implementsLifecycle()
Does the class implement theLifecycle
interface.Object
initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Called fromEnhancementAsProxyLazinessInterceptor
to 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 stateObject
initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session)
Initialize the property, and return its new value.protected void
initLockers()
protected void
initPropertyPaths(Mapping mapping)
protected void
initSubclassPropertyAliasesMap(PersistentClass model)
Must be called by subclasses, at the end of their constructorsprotected void
insert(Serializable id, Object[] fields, boolean[] notNull, int j, String sql, Object object, SharedSessionContractImplementor session)
Perform an SQL INSERT.void
insert(Serializable id, Object[] fields, Object object, SharedSessionContractImplementor session)
Persist an instanceprotected Serializable
insert(Object[] fields, boolean[] notNull, String sql, Object object, SharedSessionContractImplementor session)
Perform an SQL INSERT, and then retrieve a generated identifier.Serializable
insert(Object[] fields, Object object, SharedSessionContractImplementor session)
Persist an instance, using a natively generated identifier (optional operation)Object
instantiate(Serializable id, SharedSessionContractImplementor session)
Create a class instance initialized with the given identifierboolean
isAbstract()
Is this an abstract class?protected boolean
isAllNull(Object[] array, int tableNumber)
boolean
isBatchable()
boolean
isBatchLoadable()
Is batch loading enabled?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.protected abstract boolean
isClassOrSuperclassTable(int j)
boolean
isCollection()
Is this instance actually a CollectionPersister?boolean
isDefinedOnSubclass(int i)
Is this property defined on a subclass of the mapped class.protected boolean
isDeleteCallable(int j)
boolean
isExplicitPolymorphism()
Is this class explicit polymorphism only?boolean
isIdentifierAssignedByInsert()
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.boolean
isInherited()
Determine whether the entity is inherited one or more other entities.protected boolean
isInsertCallable(int j)
boolean
isInstance(Object object)
Is the given object an instance of this entity?boolean
isInstrumented()
Has the class actually been bytecode instrumented?protected boolean
isInverseSubclassTable(int j)
protected boolean
isInverseTable(int j)
boolean
isLazyPropertiesCacheable()
Should lazy properties of this entity be cached?protected boolean
isModifiableEntity(EntityEntry entry)
boolean
isMultiTable()
Is the inheritance hierarchy described by this persister contained across multiple tables?boolean
isMutable()
Determine whether instances of this entity are considered mutable.protected boolean
isNaturalIdNonNullable()
protected boolean
isNullableSubclassTable(int j)
protected boolean
isNullableTable(int j)
boolean
isPolymorphic()
protected abstract boolean
isPropertyOfTable(int property, int j)
boolean
isSelectBeforeUpdateRequired()
Is select snapshot before update enabled?boolean
isSubclassEntityName(String entityName)
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.protected boolean
isSubclassPropertyDeferred(String propertyName, String entityName)
boolean
isSubclassPropertyNullable(int i)
Is the numbered property of the class of subclass nullable?protected boolean
isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber, Set<String> treatAsDeclarations)
protected boolean
isSubclassTableLazy(int j)
protected boolean
isSubclassTableSequentialSelect(int j)
protected abstract boolean
isTableCascadeDeleteEnabled(int j)
Boolean
isTransient(Object entity, SharedSessionContractImplementor session)
Is this a new transient instance?protected boolean
isUpdateCallable(int j)
boolean
isVersioned()
Determine whether optimistic locking by column is enabled for this entity.boolean
isVersionPropertyGenerated()
Does this entity contain a version property that is defined to be database generated?boolean
isVersionPropertyInsertable()
Is the version property included in insert statements?Object
load(Serializable id, 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 parameterObject
load(Serializable id, 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 parameterObject
loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session)
Load an instance of the persistent class, by a unique key other than the primary key.Serializable
loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Load the id for the entity based on the natural id.void
lock(Serializable id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session)
Do a version check (optional operation)void
lock(Serializable id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session)
Do a version check (optional operation)protected void
logStaticSQL()
List
multiLoad(Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)
Performs a load of multiple entities (of this type) by identifier simultaneously.String
oneToManyFilterFragment(String alias)
String
oneToManyFilterFragment(String alias, Set<String> treatAsDeclarations)
protected OptimisticLockStyle
optimisticLockStyle()
protected void
postConstruct(Mapping mapping)
Post-construct is a callback for AbstractEntityPersister subclasses to call after they are all done with their constructor processing.void
postInstantiate()
Finish the initialization of this object.void
processInsertGeneratedProperties(Serializable id, Object entity, 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
.void
processUpdateGeneratedProperties(Serializable id, Object entity, 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
.String
propertySelectFragment(String tableAlias, String suffix, boolean allProperties)
Given a query alias and an identifying suffix, render the property select fragment.SelectFragment
propertySelectFragmentFragment(String tableAlias, String suffix, boolean allProperties)
void
registerAffectingFetchProfile(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 String
renderSelect(int[] tableNumbers, int[] columnNumbers, int[] formulaNumbers)
void
resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SharedSessionContractImplementor session)
Set the identifier and version of the given instance back to its "unsaved" value.int[]
resolveAttributeIndexes(String[] attributeNames)
Converts an array of attribute names to a set of indexes, according to the entity metamodelString
selectFragment(String alias, String suffix)
Generate a list of collection index, key and element columnsString
selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
All columns to select, when loading.void
setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session)
Inject the identifier value into the given entity.void
setPropertyValue(Object object, int i, Object value)
Set the value of a particular propertyvoid
setPropertyValue(Object object, String propertyName, Object value)
Set the value of a particular (named) propertyvoid
setPropertyValues(Object object, Object[] values)
Set the given values to the mapped properties of the given objectString[]
toColumns(String propertyName)
Given a property path, return the corresponding column name(s).String[]
toColumns(String name, int i)
Given the number of a property of a subclass, and a table alias, return the aliased column names.String[]
toColumns(String alias, String propertyName)
Obtain aliased column/formula fragments for the specified property path.String
toString()
Type
toType(String propertyName)
Given a component path expression, get the type of the propertyvoid
update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session)
Update an objectprotected boolean
update(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session)
protected void
updateOrInsert(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session)
Perform an SQL UPDATE or SQL INSERTprotected boolean
useDynamicInsert()
protected boolean
useDynamicUpdate()
protected boolean
useGetGeneratedKeys()
protected boolean
useInsertSelectIdentity()
String
whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the where clause part of any joins (optional operation)String
whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<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
getFilterAliasGenerator, getPropertySpaces
-
Methods inherited from interface org.hibernate.persister.entity.Joinable
getTableName
-
Methods inherited from interface org.hibernate.persister.entity.Loadable
getDiscriminatorType, getDiscriminatorValue, getSubclassForDiscriminatorValue
-
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 String ENTITY_CLASS
- See Also:
- Constant Field Values
-
VERSION_COLUMN_ALIAS
public static final String VERSION_COLUMN_ALIAS
- See Also:
- Constant Field Values
-
batchSize
protected final int batchSize
-
rowIdName
protected final String rowIdName
-
insertCallable
protected boolean[] insertCallable
-
updateCallable
protected boolean[] updateCallable
-
deleteCallable
protected boolean[] deleteCallable
-
customSQLInsert
protected String[] customSQLInsert
-
customSQLUpdate
protected String[] customSQLUpdate
-
customSQLDelete
protected 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, String name, String suffix)
-
getSubclassColumnTableNumberClosure
protected abstract int[] getSubclassColumnTableNumberClosure()
-
getSubclassFormulaTableNumberClosure
protected abstract int[] getSubclassFormulaTableNumberClosure()
-
getSubclassTableName
public abstract String getSubclassTableName(int j)
Description copied from interface:Queryable
Get the name of the table with the given index from the internal array.- Specified by:
getSubclassTableName
in interfaceQueryable
- Parameters:
j
- The index into the internal array.
-
getSubclassTableKeyColumns
protected abstract String[] getSubclassTableKeyColumns(int j)
-
isClassOrSuperclassTable
protected abstract boolean isClassOrSuperclassTable(int j)
-
getSubclassTableSpan
public abstract int getSubclassTableSpan()
-
getTableSpan
protected abstract int getTableSpan()
-
isTableCascadeDeleteEnabled
protected abstract boolean isTableCascadeDeleteEnabled(int j)
-
getTableName
protected abstract String getTableName(int j)
-
getKeyColumns
protected abstract String[] getKeyColumns(int j)
-
isPropertyOfTable
protected 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 String filterFragment(String alias) throws MappingException
- Throws:
MappingException
-
filterFragment
protected abstract String filterFragment(String alias, Set<String> treatAsDeclarations)
-
getDiscriminatorColumnName
public String getDiscriminatorColumnName()
- Specified by:
getDiscriminatorColumnName
in interfaceLoadable
- Returns:
- the column name for the discriminator as specified in the mapping.
-
getDiscriminatorColumnReaders
public String getDiscriminatorColumnReaders()
-
getDiscriminatorColumnReaderTemplate
public String getDiscriminatorColumnReaderTemplate()
-
getDiscriminatorAlias
protected String getDiscriminatorAlias()
-
getDiscriminatorFormulaTemplate
protected String getDiscriminatorFormulaTemplate()
-
isInverseTable
protected boolean isInverseTable(int j)
-
isNullableTable
protected boolean isNullableTable(int j)
-
isNullableSubclassTable
protected boolean isNullableSubclassTable(int j)
-
isInverseSubclassTable
protected boolean isInverseSubclassTable(int j)
-
isSubclassEntityName
public boolean isSubclassEntityName(String entityName)
Description copied from interface:EntityPersister
Determine whether the given name represents a subclass entity (or this entity itself) of the entity mapped by this persister.- Specified by:
isSubclassEntityName
in 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 String[] getRootTableKeyColumnNames()
Description copied from interface:PostInsertIdentityPersister
The names of the primary key columns in the root table.- Specified by:
getRootTableKeyColumnNames
in interfacePostInsertIdentityPersister
- Returns:
- The primary key column names.
-
getSQLUpdateByRowIdStrings
protected String[] getSQLUpdateByRowIdStrings()
-
getSQLLazyUpdateByRowIdStrings
protected String[] getSQLLazyUpdateByRowIdStrings()
-
getSQLSnapshotSelectString
protected String getSQLSnapshotSelectString()
-
getSQLDeleteStrings
protected String[] getSQLDeleteStrings()
-
getSQLInsertStrings
protected String[] getSQLInsertStrings()
-
getSQLUpdateStrings
protected String[] getSQLUpdateStrings()
-
getSQLLazyUpdateStrings
protected String[] getSQLLazyUpdateStrings()
-
getSQLIdentityInsertString
protected String getSQLIdentityInsertString()
The query that inserts a row, letting the database generate an id- Returns:
- The IDENTITY-based insertion query.
-
getVersionSelectString
protected String getVersionSelectString()
-
isInsertCallable
protected boolean isInsertCallable(int j)
-
isUpdateCallable
protected boolean isUpdateCallable(int j)
-
isDeleteCallable
protected boolean isDeleteCallable(int j)
-
isSubclassPropertyDeferred
protected boolean isSubclassPropertyDeferred(String propertyName, String entityName)
-
isSubclassTableSequentialSelect
protected boolean isSubclassTableSequentialSelect(int j)
-
hasSequentialSelect
public boolean hasSequentialSelect()
-
getTableUpdateNeeded
protected boolean[] getTableUpdateNeeded(int[] dirtyProperties, boolean hasDirtyCollection)
Decide which tables need to be updated. The return here is an array of boolean values with each index corresponding to a given table in the scope of this persister.- Parameters:
dirtyProperties
- The indices of all the entity properties considered dirty.hasDirtyCollection
- Whether any collections owned by the entity which were considered dirty.- Returns:
- Array of booleans indicating which table require updating.
-
hasRowId
public boolean hasRowId()
Description copied from interface:Loadable
Does the result set contain rowids?
-
getPropertyColumnUpdateable
protected boolean[][] getPropertyColumnUpdateable()
-
getPropertyColumnInsertable
protected boolean[][] getPropertyColumnInsertable()
-
getPropertySelectable
protected boolean[] getPropertySelectable()
-
buildCacheEntryHelper
protected AbstractEntityPersister.CacheEntryHelper buildCacheEntryHelper()
-
canUseReferenceCacheEntries
public boolean canUseReferenceCacheEntries()
- Specified by:
canUseReferenceCacheEntries
in interfaceEntityPersister
-
getTemplateFromString
protected static String getTemplateFromString(String string, SessionFactoryImplementor factory)
-
generateLazySelectStringsByFetchGroup
protected Map<String,String> generateLazySelectStringsByFetchGroup()
-
initializeLazyProperty
public Object initializeLazyProperty(String fieldName, Object entity, SharedSessionContractImplementor session)
Description copied from interface:LazyPropertyInitializer
Initialize the property, and return its new value.- Specified by:
initializeLazyProperty
in 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 Serializable getCollectionKey(CollectionPersister persister, Object owner, EntityEntry ownerEntry, SharedSessionContractImplementor session)
-
isBatchable
public boolean isBatchable()
-
getNavigableRole
public NavigableRole getNavigableRole()
- Specified by:
getNavigableRole
in interfaceEntityPersister
-
getQuerySpaces
public Serializable[] getQuerySpaces()
Description copied from interface:EntityPersister
Returns an array of objects that identify spaces in which properties of this entity are persisted, for instances of this class and its subclasses. Much likeEntityPersister.getPropertySpaces()
, except that here we include subclass entity spaces.- Specified by:
getQuerySpaces
in interfaceEntityPersister
- Returns:
- The query spaces.
-
isBatchLoadable
public boolean isBatchLoadable()
Description copied from interface:EntityPersister
Is batch loading enabled?- Specified by:
isBatchLoadable
in interfaceEntityPersister
-
getIdentifierColumnNames
public String[] getIdentifierColumnNames()
Description copied from interface:Loadable
Get the names of columns used to persist the identifier- Specified by:
getIdentifierColumnNames
in interfaceLoadable
- Specified by:
getIdentifierColumnNames
in interfacePostInsertIdentityPersister
- Specified by:
getIdentifierColumnNames
in interfaceQueryable
-
getIdentifierColumnReaders
public String[] getIdentifierColumnReaders()
-
getIdentifierColumnReaderTemplates
public String[] getIdentifierColumnReaderTemplates()
-
getIdentifierColumnSpan
protected int getIdentifierColumnSpan()
-
getIdentifierAliases
protected String[] getIdentifierAliases()
-
getVersionColumnName
public String getVersionColumnName()
Description copied from interface:Lockable
For versioned entities, get the name of the column (again, expected on the root table) used to store the version values.- Specified by:
getVersionColumnName
in interfaceLockable
- Returns:
- The version column name.
-
getVersionedTableName
protected String getVersionedTableName()
-
getSubclassColumnLazyiness
protected boolean[] getSubclassColumnLazyiness()
-
getSubclassFormulaLazyiness
protected boolean[] getSubclassFormulaLazyiness()
-
isCacheInvalidationRequired
public boolean isCacheInvalidationRequired()
We can't immediately add to the cache if we have formulas which must be evaluated, or if we have the possibility of two concurrent updates to the same item being merged on the database. This can happen if (a) the item is not versioned and either (b) we have dynamic update enabled or (c) we have multiple tables holding the state of the item.- Specified by:
isCacheInvalidationRequired
in interfaceEntityPersister
-
isLazyPropertiesCacheable
public boolean isLazyPropertiesCacheable()
Description copied from interface:EntityPersister
Should lazy properties of this entity be cached?- Specified by:
isLazyPropertiesCacheable
in interfaceEntityPersister
-
selectFragment
public String selectFragment(String alias, String suffix)
Description copied from interface:OuterJoinLoadable
Generate a list of collection index, key and element columns- Specified by:
selectFragment
in interfaceOuterJoinLoadable
- Specified by:
selectFragment
in interfaceSQLLoadable
-
getIdentifierAliases
public String[] getIdentifierAliases(String suffix)
Description copied from interface:Loadable
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getIdentifierAliases
in interfaceLoadable
-
getPropertyAliases
public String[] getPropertyAliases(String suffix, int i)
Description copied from interface:Loadable
Get the result set aliases used for the property columns, given a suffix (properties of this class, only).- Specified by:
getPropertyAliases
in interfaceLoadable
-
getDiscriminatorAlias
public String getDiscriminatorAlias(String suffix)
Description copied from interface:Loadable
Get the result set aliases used for the identifier columns, given a suffix- Specified by:
getDiscriminatorAlias
in interfaceLoadable
-
identifierSelectFragment
public String identifierSelectFragment(String name, String suffix)
Description copied from interface:Queryable
Given a query alias and an identifying suffix, render the identifier select fragment.- Specified by:
identifierSelectFragment
in interfaceQueryable
-
propertySelectFragment
public String propertySelectFragment(String tableAlias, String suffix, boolean allProperties)
Description copied from interface:Queryable
Given a query alias and an identifying suffix, render the property select fragment.- Specified by:
propertySelectFragment
in interfaceQueryable
-
propertySelectFragmentFragment
public SelectFragment propertySelectFragmentFragment(String tableAlias, String suffix, boolean allProperties)
- Specified by:
propertySelectFragmentFragment
in interfaceQueryable
-
getDatabaseSnapshot
public Object[] getDatabaseSnapshot(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Get the current database state of the object, in a "hydrated" form, without resolving identifiers- Specified by:
getDatabaseSnapshot
in interfaceEntityPersister
- Returns:
- null if there is no row in the database
- Throws:
HibernateException
-
getIdByUniqueKey
public Serializable getIdByUniqueKey(Serializable key, String uniquePropertyName, SharedSessionContractImplementor session) throws HibernateException
- Specified by:
getIdByUniqueKey
in interfaceEntityPersister
- Throws:
HibernateException
-
generateIdByUniqueKeySelectString
protected String generateIdByUniqueKeySelectString(String uniquePropertyName)
-
generateSelectVersionString
protected String generateSelectVersionString()
Generate the SQL that selects the version number by id
-
getPropertyUniqueness
public boolean[] getPropertyUniqueness()
-
generateInsertGeneratedValuesSelectString
protected String generateInsertGeneratedValuesSelectString()
-
generateUpdateGeneratedValuesSelectString
protected String generateUpdateGeneratedValuesSelectString()
-
concretePropertySelectFragment
protected String concretePropertySelectFragment(String alias, boolean[] includeProperty)
-
concretePropertySelectFragment
protected String concretePropertySelectFragment(String alias, AbstractEntityPersister.InclusionChecker inclusionChecker)
-
generateSnapshotSelectString
protected String generateSnapshotSelectString()
-
forceVersionIncrement
public Object forceVersionIncrement(Serializable id, Object currentVersion, SharedSessionContractImplementor session)
- Specified by:
forceVersionIncrement
in interfaceEntityPersister
-
getCurrentVersion
public Object getCurrentVersion(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Retrieve the version number- Specified by:
getCurrentVersion
in interfaceEntityPersister
- Throws:
HibernateException
-
initLockers
protected void initLockers()
-
generateLocker
protected LockingStrategy generateLocker(LockMode lockMode)
-
lock
public void lock(Serializable id, Object version, Object object, LockMode lockMode, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Do a version check (optional operation)- Specified by:
lock
in interfaceEntityPersister
- Throws:
HibernateException
-
lock
public void lock(Serializable id, Object version, Object object, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Do a version check (optional operation)- Specified by:
lock
in interfaceEntityPersister
- Throws:
HibernateException
-
getRootTableName
public String getRootTableName()
Description copied from interface:Lockable
Locks are always applied to the "root table".- Specified by:
getRootTableName
in interfaceLockable
- Returns:
- The root table name
-
getRootTableAlias
public String getRootTableAlias(String drivingAlias)
Description copied from interface:Lockable
Get the SQL alias this persister would use for the root table given the passed driving alias.- Specified by:
getRootTableAlias
in 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 String[] getRootTableIdentifierColumnNames()
Description copied from interface:Lockable
Get the names of columns on the root table used to persist the identifier.- Specified by:
getRootTableIdentifierColumnNames
in interfaceLockable
- Returns:
- The root table identifier column names.
-
toColumns
public String[] toColumns(String alias, String propertyName) throws QueryException
Obtain aliased column/formula fragments for the specified property path. Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
toColumns
in interfacePropertyMapping
- Throws:
QueryException
-
toColumns
public String[] toColumns(String propertyName) throws QueryException
Given a property path, return the corresponding column name(s). Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
toColumns
in interfacePropertyMapping
- Throws:
QueryException
-
toType
public Type toType(String propertyName) throws QueryException
Given a component path expression, get the type of the property Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
toType
in interfacePropertyMapping
- Throws:
QueryException
-
getPropertyColumnNames
public String[] getPropertyColumnNames(String propertyName)
Get the column names for the given property path Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
getPropertyColumnNames
in interfaceOuterJoinLoadable
-
getSubclassPropertyTableNumber
public int getSubclassPropertyTableNumber(String propertyPath)
Warning: When there are duplicated property names in the subclasses of the class, this method may return the wrong table number for the duplicated subclass property (note that SingleTableEntityPersister defines an overloaded form which takes the entity name.- Specified by:
getSubclassPropertyTableNumber
in 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(String propertyPath)
Description copied from interface:Queryable
Determine 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:
getSubclassPropertyDeclarer
in interfaceQueryable
- Parameters:
propertyPath
- The property name.- Returns:
- The property declarer
-
getTypeDiscriminatorMetadata
public DiscriminatorMetadata getTypeDiscriminatorMetadata()
Description copied from interface:Queryable
Retrieve the information needed to properly deal with this entity's discriminator in a query.- Specified by:
getTypeDiscriminatorMetadata
in interfaceQueryable
- Returns:
- The entity discriminator metadata
-
toColumns
public String[] toColumns(String name, int i)
Description copied from interface:OuterJoinLoadable
Given the number of a property of a subclass, and a table alias, return the aliased column names.- Specified by:
toColumns
in interfaceOuterJoinLoadable
-
getPropertySubclassNames
protected String[] getPropertySubclassNames()
-
getPropertyColumnNames
public String[] getPropertyColumnNames(int i)
Description copied from interface:Loadable
Get the result set column names mapped for this property (properties of this class, only).- Specified by:
getPropertyColumnNames
in interfaceLoadable
-
getPropertyColumnWriters
public String[] getPropertyColumnWriters(int i)
-
getPropertyColumnSpan
protected int getPropertyColumnSpan(int i)
-
hasFormulaProperties
protected boolean hasFormulaProperties()
-
getFetchMode
public FetchMode getFetchMode(int i)
Description copied from interface:OuterJoinLoadable
May this (subclass closure) property be fetched using an SQL outerjoin?- Specified by:
getFetchMode
in interfaceOuterJoinLoadable
-
getCascadeStyle
public CascadeStyle getCascadeStyle(int i)
Description copied from interface:OuterJoinLoadable
Get the cascade style of this (subclass closure) property- Specified by:
getCascadeStyle
in interfaceOuterJoinLoadable
-
getSubclassPropertyType
public Type getSubclassPropertyType(int i)
Description copied from interface:OuterJoinLoadable
Get the type of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyType
in interfaceOuterJoinLoadable
-
getSubclassPropertyName
public String getSubclassPropertyName(int i)
Description copied from interface:OuterJoinLoadable
Get the name of the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyName
in interfaceOuterJoinLoadable
-
countSubclassProperties
public int countSubclassProperties()
Description copied from interface:OuterJoinLoadable
How many properties are there, for this class and all subclasses?- Specified by:
countSubclassProperties
in interfaceOuterJoinLoadable
-
getSubclassPropertyColumnNames
public String[] getSubclassPropertyColumnNames(int i)
Description copied from interface:OuterJoinLoadable
Return the column names used to persist the numbered property of the class or a subclass.- Specified by:
getSubclassPropertyColumnNames
in interfaceOuterJoinLoadable
-
isDefinedOnSubclass
public boolean isDefinedOnSubclass(int i)
Description copied from interface:OuterJoinLoadable
Is this property defined on a subclass of the mapped class.- Specified by:
isDefinedOnSubclass
in interfaceOuterJoinLoadable
-
getSubclassPropertyFormulaTemplateClosure
public String[][] getSubclassPropertyFormulaTemplateClosure()
- Specified by:
getSubclassPropertyFormulaTemplateClosure
in interfaceQueryable
-
getSubclassPropertyTypeClosure
protected Type[] getSubclassPropertyTypeClosure()
-
getSubclassPropertyColumnNameClosure
protected String[][] getSubclassPropertyColumnNameClosure()
-
getSubclassPropertyColumnReaderClosure
public String[][] getSubclassPropertyColumnReaderClosure()
-
getSubclassPropertyColumnReaderTemplateClosure
public String[][] getSubclassPropertyColumnReaderTemplateClosure()
-
getSubclassPropertyNameClosure
protected String[] getSubclassPropertyNameClosure()
-
resolveAttributeIndexes
public int[] resolveAttributeIndexes(String[] attributeNames)
Description copied from interface:EntityPersister
Converts an array of attribute names to a set of indexes, according to the entity metamodel- Specified by:
resolveAttributeIndexes
in interfaceEntityPersister
- Parameters:
attributeNames
- Array of names to be resolved- Returns:
- A set of unique indexes of the attribute names found in the metamodel
-
getSubclassPropertySubclassNameClosure
protected String[] getSubclassPropertySubclassNameClosure()
-
getSubclassColumnClosure
protected String[] getSubclassColumnClosure()
-
getSubclassColumnAliasClosure
protected String[] getSubclassColumnAliasClosure()
-
getSubclassColumnReaderTemplateClosure
public String[] getSubclassColumnReaderTemplateClosure()
-
getSubclassFormulaClosure
protected String[] getSubclassFormulaClosure()
-
getSubclassFormulaTemplateClosure
protected String[] getSubclassFormulaTemplateClosure()
-
getSubclassFormulaAliasClosure
protected String[] getSubclassFormulaAliasClosure()
-
getSubclassPropertyColumnAliases
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix)
Description copied from interface:SQLLoadable
Return the column alias names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnAliases
in interfaceSQLLoadable
-
getSubclassPropertyColumnNames
public String[] getSubclassPropertyColumnNames(String propertyName)
Description copied from interface:SQLLoadable
Return the column names used to persist/query the named property of the class or a subclass (optional operation).- Specified by:
getSubclassPropertyColumnNames
in interfaceSQLLoadable
-
initSubclassPropertyAliasesMap
protected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException
Must be called by subclasses, at the end of their constructors- Throws:
MappingException
-
loadByUniqueKey
public Object loadByUniqueKey(String propertyName, Object uniqueKey, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:UniqueKeyLoadable
Load an instance of the persistent class, by a unique key other than the primary key.- Specified by:
loadByUniqueKey
in interfaceUniqueKeyLoadable
- Throws:
HibernateException
-
getPropertyIndex
public int getPropertyIndex(String propertyName)
Description copied from interface:UniqueKeyLoadable
Get the property number of the unique key property- Specified by:
getPropertyIndex
in interfaceUniqueKeyLoadable
-
createUniqueKeyLoaders
protected void createUniqueKeyLoaders() throws MappingException
- Throws:
MappingException
-
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:
- Throws:
MappingException
-
check
protected boolean check(int rows, Serializable id, int tableNumber, Expectation expectation, PreparedStatement statement) throws HibernateException
- Throws:
HibernateException
-
generateUpdateString
protected String generateUpdateString(boolean[] includeProperty, int j, boolean useRowId)
-
generateUpdateString
protected String generateUpdateString(boolean[] includeProperty, int j, Object[] oldFields, boolean useRowId)
Generate the SQL that updates a row by id (and version)
-
checkVersion
protected final boolean checkVersion(boolean[] includeProperty)
-
generateInsertString
protected String generateInsertString(boolean[] includeProperty, int j)
-
generateInsertString
protected String generateInsertString(boolean identityInsert, boolean[] includeProperty)
-
generateInsertString
protected String generateInsertString(boolean identityInsert, boolean[] includeProperty, int j)
Generate the SQL that inserts a row
-
generateIdentityInsertString
protected String generateIdentityInsertString(boolean[] includeProperty)
Used to generate an insery 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
protected String generateDeleteString(int j)
Generate the SQL that deletes a row by id (and version)
-
dehydrate
protected int dehydrate(Serializable id, Object[] fields, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement st, SharedSessionContractImplementor session, boolean isUpdate) throws HibernateException, SQLException
- Throws:
HibernateException
SQLException
-
dehydrate
protected int dehydrate(Serializable id, Object[] fields, Object rowId, boolean[] includeProperty, boolean[][] includeColumns, int j, PreparedStatement ps, SharedSessionContractImplementor session, int index, boolean isUpdate) throws SQLException, HibernateException
Marshall the fields of a persistent instance to a prepared statement- Throws:
SQLException
HibernateException
-
hydrate
public Object[] hydrate(ResultSet rs, Serializable id, Object object, Loadable rootLoadable, String[][] suffixedPropertyColumns, boolean allProperties, SharedSessionContractImplementor session) throws SQLException, HibernateException
Unmarshall the fields of a persistent instance from a result set, without resolving associations or collections. Question: should this really be here, or should it be sent back to Loader?- Specified by:
hydrate
in interfaceLoadable
- Throws:
SQLException
HibernateException
-
useInsertSelectIdentity
protected boolean useInsertSelectIdentity()
-
useGetGeneratedKeys
protected boolean useGetGeneratedKeys()
-
insert
protected Serializable insert(Object[] fields, boolean[] notNull, String sql, Object object, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL INSERT, and then retrieve a generated identifier. This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY, select, etc).- Throws:
HibernateException
-
getIdentitySelectString
public String getIdentitySelectString()
Description copied from interface:PostInsertIdentityPersister
Get the database-specific SQL command to retrieve the last generated IDENTITY value.- Specified by:
getIdentitySelectString
in interfacePostInsertIdentityPersister
- Returns:
- The SQL command string
-
getSelectByUniqueKeyString
public String getSelectByUniqueKeyString(String propertyName)
Description copied from interface:PostInsertIdentityPersister
Get a SQL select string that performs a select based on a unique key determined by the given property name).- Specified by:
getSelectByUniqueKeyString
in 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
protected void insert(Serializable id, Object[] fields, boolean[] notNull, int j, String sql, Object object, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL INSERT. This for is used for all non-root tables as well as the root table in cases where the identifier value is known before the insert occurs.- Throws:
HibernateException
-
updateOrInsert
protected void updateOrInsert(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session) throws HibernateException
Perform an SQL UPDATE or SQL INSERT- Throws:
HibernateException
-
update
protected boolean update(Serializable id, Object[] fields, Object[] oldFields, Object rowId, boolean[] includeProperty, int j, Object oldVersion, Object object, String sql, SharedSessionContractImplementor session) throws HibernateException
- Throws:
HibernateException
-
delete
protected void delete(Serializable id, Object version, int j, Object object, String sql, SharedSessionContractImplementor session, Object[] loadedState) throws HibernateException
Perform an SQL DELETE- Throws:
HibernateException
-
update
public void update(Serializable id, Object[] fields, int[] dirtyFields, boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object object, Object rowId, SharedSessionContractImplementor session) throws HibernateException
Update an object- Specified by:
update
in interfaceEntityPersister
- Throws:
HibernateException
-
insert
public Serializable insert(Object[] fields, Object object, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Persist an instance, using a natively generated identifier (optional operation)- Specified by:
insert
in interfaceEntityPersister
- Throws:
HibernateException
-
insert
public void insert(Serializable id, Object[] fields, Object object, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Persist an instance- Specified by:
insert
in interfaceEntityPersister
-
delete
public void delete(Serializable id, Object version, Object object, SharedSessionContractImplementor session) throws HibernateException
Delete an object- Specified by:
delete
in interfaceEntityPersister
- Throws:
HibernateException
-
logStaticSQL
protected void logStaticSQL()
-
filterFragment
public String filterFragment(String alias, Map enabledFilters) throws MappingException
Description copied from interface:Joinable
Get the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragment
in interfaceJoinable
- Throws:
MappingException
-
filterFragment
public String filterFragment(String alias, Map enabledFilters, Set<String> treatAsDeclarations)
Description copied from interface:Joinable
Get the where clause filter, given a query alias and considering enabled session filters- Specified by:
filterFragment
in interfaceJoinable
-
generateFilterConditionAlias
public String generateFilterConditionAlias(String rootAlias)
Description copied from interface:Queryable
The alias used for any filter conditions (mapped where-fragments or enabled-filters). This may or may not be different from the root alias depending upon the inheritance mapping strategy.- Specified by:
generateFilterConditionAlias
in interfaceQueryable
- Parameters:
rootAlias
- The root alias- Returns:
- The alias used for "filter conditions" within the where clause.
-
oneToManyFilterFragment
public String oneToManyFilterFragment(String alias) throws MappingException
- Specified by:
oneToManyFilterFragment
in interfaceJoinable
- Throws:
MappingException
-
oneToManyFilterFragment
public String oneToManyFilterFragment(String alias, Set<String> treatAsDeclarations)
- Specified by:
oneToManyFilterFragment
in interfaceJoinable
-
fromJoinFragment
public String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Description copied from interface:Joinable
Get the from clause part of any joins (optional operation)- Specified by:
fromJoinFragment
in interfaceJoinable
-
fromJoinFragment
public String fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
Description copied from interface:Joinable
Get the from clause part of any joins (optional operation)- Specified by:
fromJoinFragment
in interfaceJoinable
-
whereJoinFragment
public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Description copied from interface:Joinable
Get the where clause part of any joins (optional operation)- Specified by:
whereJoinFragment
in interfaceJoinable
-
whereJoinFragment
public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
Description copied from interface:Joinable
Get the where clause part of any joins (optional operation)- Specified by:
whereJoinFragment
in interfaceJoinable
-
isSubclassTableLazy
protected boolean isSubclassTableLazy(int j)
-
createJoin
protected JoinFragment createJoin(String name, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
-
determineSubclassTableJoinType
protected JoinType determineSubclassTableJoinType(int subclassTableNumber, boolean canInnerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations)
-
isSubclassTableIndicatedByTreatAsDeclarations
protected boolean isSubclassTableIndicatedByTreatAsDeclarations(int subclassTableNumber, Set<String> treatAsDeclarations)
-
createJoin
protected JoinFragment createJoin(int[] tableNumbers, String drivingAlias)
-
createSelect
protected SelectFragment createSelect(int[] subclassColumnNumbers, int[] subclassFormulaNumbers)
-
renderSelect
protected 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 MappingException
Description copied from interface:EntityPersister
Finish the initialization of this object.EntityPersister.generateEntityDefinition()
must be called for all entity persisters before calling this method. Called only once perSessionFactory
lifecycle, after all entity persisters have been instantiated.- Specified by:
postInstantiate
in interfaceEntityPersister
- Throws:
MappingException
- Indicates an issue in the metadata.
-
doPostInstantiate
protected void doPostInstantiate()
-
getLoaders
@Deprecated protected Map getLoaders()
Deprecated.Because there are better patterns for this"Needed" by subclasses to override the createLoader strategy
-
createLoaders
protected void createLoaders()
-
getLoaderByLockMode
protected final UniqueEntityLoader getLoaderByLockMode(LockMode lockMode)
-
createQueryLoader
protected void createQueryLoader()
-
load
public Object load(Serializable id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session)
Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter- Specified by:
load
in interfaceEntityPersister
-
load
public Object load(Serializable id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException
Load an instance using either the forUpdateLoader or the outer joining loader, depending upon the value of the lock parameter- Specified by:
load
in interfaceEntityPersister
- Throws:
HibernateException
-
initializeEnhancedEntityUsedAsProxy
public Object initializeEnhancedEntityUsedAsProxy(Object entity, String nameOfAttributeBeingAccessed, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Called fromEnhancementAsProxyLazinessInterceptor
to 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:
initializeEnhancedEntityUsedAsProxy
in interfaceEntityPersister
-
multiLoad
public List multiLoad(Serializable[] ids, SharedSessionContractImplementor session, MultiLoadOptions loadOptions)
Description copied from interface:EntityPersister
Performs a load of multiple entities (of this type) by identifier simultaneously.- Specified by:
multiLoad
in interfaceEntityPersister
- Parameters:
ids
- The identifiers to loadsession
- The originating SesisonloadOptions
- The options for loading- Returns:
- The loaded, matching entities
-
registerAffectingFetchProfile
public void registerAffectingFetchProfile(String fetchProfileName)
Description copied from interface:Loadable
Register the name of a fetch profile determined to have an affect on the underlying loadable in regards to the fact that the underlying load SQL needs to be adjust when the given fetch profile is enabled.- Specified by:
registerAffectingFetchProfile
in interfaceLoadable
- Parameters:
fetchProfileName
- The name of the profile affecting this.
-
getAppropriateLoader
protected UniqueEntityLoader getAppropriateLoader(LockOptions lockOptions, SharedSessionContractImplementor session)
-
isAllNull
protected final boolean isAllNull(Object[] array, int tableNumber)
-
isSubclassPropertyNullable
public boolean isSubclassPropertyNullable(int i)
Description copied from interface:OuterJoinLoadable
Is the numbered property of the class of subclass nullable?- Specified by:
isSubclassPropertyNullable
in interfaceOuterJoinLoadable
-
getPropertiesToUpdate
protected 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
protected boolean[] getPropertiesToInsert(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(Object[] currentState, Object[] previousState, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.- Specified by:
findDirty
in 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(Object[] old, Object[] current, Object entity, SharedSessionContractImplementor session) throws HibernateException
Locate the property-indices of all properties considered to be dirty.- Specified by:
findModified
in 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
protected boolean[] getPropertyUpdateability(Object entity)
Which properties appear in the SQL update? (Initialized, updateable ones!)
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:EntityPersister
Return the SessionFactory to which this persister "belongs".- Specified by:
getFactory
in interfaceEntityPersister
- Returns:
- The owning SessionFactory.
-
getEntityMetamodel
public EntityMetamodel getEntityMetamodel()
Description copied from interface:EntityPersister
Retrieve the underlying entity metamodel instance...- Specified by:
getEntityMetamodel
in interfaceEntityPersister
- Returns:
- The metamodel
-
canReadFromCache
public boolean canReadFromCache()
- Specified by:
canReadFromCache
in interfaceEntityPersister
-
canWriteToCache
public boolean canWriteToCache()
- Specified by:
canWriteToCache
in interfaceEntityPersister
-
hasCache
public boolean hasCache()
Description copied from interface:EntityPersister
Does this class have a cache.- Specified by:
hasCache
in interfaceEntityPersister
-
getCacheAccessStrategy
public EntityDataAccess getCacheAccessStrategy()
Description copied from interface:EntityPersister
Get the cache (optional operation)- Specified by:
getCacheAccessStrategy
in interfaceEntityPersister
-
getCacheEntryStructure
public CacheEntryStructure getCacheEntryStructure()
Description copied from interface:EntityPersister
Get the cache structure- Specified by:
getCacheEntryStructure
in interfaceEntityPersister
-
buildCacheEntry
public CacheEntry buildCacheEntry(Object entity, Object[] state, Object version, SharedSessionContractImplementor session)
- Specified by:
buildCacheEntry
in interfaceEntityPersister
-
hasNaturalIdCache
public boolean hasNaturalIdCache()
Description copied from interface:EntityPersister
Does this class have a natural id cache- Specified by:
hasNaturalIdCache
in interfaceEntityPersister
-
getNaturalIdCacheAccessStrategy
public NaturalIdDataAccess getNaturalIdCacheAccessStrategy()
Description copied from interface:EntityPersister
Get the NaturalId cache (optional operation)- Specified by:
getNaturalIdCacheAccessStrategy
in interfaceEntityPersister
-
getVersionComparator
public Comparator getVersionComparator()
-
getEntityName
public final String getEntityName()
Description copied from interface:EntityPersister
The entity name which this persister maps.- Specified by:
getEntityName
in interfaceClassMetadata
- Specified by:
getEntityName
in interfaceEntityPersister
- Returns:
- The name of the entity which this persister maps.
-
getEntityType
public EntityType getEntityType()
- Specified by:
getEntityType
in interfaceOuterJoinLoadable
-
isPolymorphic
public boolean isPolymorphic()
-
isInherited
public boolean isInherited()
Description copied from interface:EntityPersister
Determine whether the entity is inherited one or more other entities. In other words, is this entity a subclass of other entities.- Specified by:
isInherited
in interfaceClassMetadata
- Specified by:
isInherited
in interfaceEntityPersister
- Returns:
- True if other entities extend this entity; false otherwise.
-
hasCascades
public boolean hasCascades()
Description copied from interface:EntityPersister
Determine whether this entity has any non-none cascading.- Specified by:
hasCascades
in 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:EntityPersister
Determine whether the entity has a particular property holding the identifier value.- Specified by:
hasIdentifierProperty
in interfaceClassMetadata
- Specified by:
hasIdentifierProperty
in interfaceEntityPersister
- Returns:
- True if the entity has a specific property holding identifier value.
-
getVersionType
public VersionType getVersionType()
Description copied from interface:EntityPersister
IfEntityPersister.isVersioned()
, then what is the type of the property holding the locking value.- Specified by:
getVersionType
in interfaceEntityPersister
- Returns:
- The type of the version property; or null, if not versioned.
-
getVersionProperty
public int getVersionProperty()
Description copied from interface:EntityPersister
IfEntityPersister.isVersioned()
, then what is the index of the property holding the locking value.- Specified by:
getVersionProperty
in interfaceClassMetadata
- Specified by:
getVersionProperty
in interfaceEntityPersister
- Returns:
- The type of the version property; or -66, if not versioned.
-
isVersioned
public boolean isVersioned()
Description copied from interface:EntityPersister
Determine whether optimistic locking by column is enabled for this entity.- Specified by:
isVersioned
in interfaceClassMetadata
- Specified by:
isVersioned
in interfaceEntityPersister
- Returns:
- True if optimistic locking by column (i.e.,
or ) is enabled; false otherwise.
-
isIdentifierAssignedByInsert
public boolean isIdentifierAssignedByInsert()
Description copied from interface:EntityPersister
Are identifiers of this entity assigned known before the insert execution? Or, are they generated (in the database) by the insert execution.- Specified by:
isIdentifierAssignedByInsert
in interfaceEntityPersister
- Returns:
- True if identifiers for this entity are generated by the insert execution.
-
hasLazyProperties
public boolean hasLazyProperties()
Description copied from interface:EntityPersister
Determine whether this entity defines any lazy properties (ala bytecode instrumentation).- Specified by:
hasLazyProperties
in interfaceEntityPersister
- Returns:
- True if the entity has properties mapped as lazy; false otherwise.
-
afterReassociate
public void afterReassociate(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Called just after the entity has been reassociated with the session- Specified by:
afterReassociate
in interfaceEntityPersister
-
isTransient
public Boolean isTransient(Object entity, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Is this a new transient instance?- Specified by:
isTransient
in interfaceEntityPersister
- Throws:
HibernateException
-
hasCollections
public boolean hasCollections()
Description copied from interface:EntityPersister
Determine whether this entity contains references to persistent collections.- Specified by:
hasCollections
in interfaceEntityPersister
- Returns:
- True if the entity does contain persistent collections; false otherwise.
-
hasMutableProperties
public boolean hasMutableProperties()
Description copied from interface:EntityPersister
Determine whether any properties of this entity are considered mutable.- Specified by:
hasMutableProperties
in interfaceEntityPersister
- Returns:
- True if any properties of the entity are mutable; false otherwise (meaning none are).
-
isMutable
public boolean isMutable()
Description copied from interface:EntityPersister
Determine whether instances of this entity are considered mutable.- Specified by:
isMutable
in interfaceClassMetadata
- Specified by:
isMutable
in interfaceEntityPersister
- Returns:
- True if the entity is considered mutable; false otherwise.
-
isModifiableEntity
protected final boolean isModifiableEntity(EntityEntry entry)
-
isAbstract
public boolean isAbstract()
Description copied from interface:Queryable
Is this an abstract class?- Specified by:
isAbstract
in interfaceLoadable
- Specified by:
isAbstract
in interfaceQueryable
-
hasSubclasses
public boolean hasSubclasses()
Description copied from interface:Loadable
Does this persistent class have subclasses?- Specified by:
hasSubclasses
in interfaceClassMetadata
- Specified by:
hasSubclasses
in interfaceLoadable
-
hasProxy
public boolean hasProxy()
Description copied from interface:EntityPersister
Determine whether this entity supports dynamic proxies.- Specified by:
hasProxy
in interfaceClassMetadata
- Specified by:
hasProxy
in interfaceEntityPersister
- Returns:
- True if the entity has dynamic proxy support; false otherwise.
-
getIdentifierGenerator
public IdentifierGenerator getIdentifierGenerator() throws HibernateException
Description copied from interface:EntityPersister
Determine which identifier generation strategy is used for this entity.- Specified by:
getIdentifierGenerator
in interfaceEntityPersister
- Returns:
- The identifier generation strategy.
- Throws:
HibernateException
-
getRootEntityName
public String getRootEntityName()
Description copied from interface:EntityPersister
Returns an object that identifies the space in which identifiers of this entity hierarchy are unique. Might be a table name, a JNDI URL, etc.- Specified by:
getRootEntityName
in interfaceEntityPersister
- Returns:
- The root entity name.
-
getClassMetadata
public ClassMetadata getClassMetadata()
Description copied from interface:EntityPersister
Get the user-visible metadata for the class (optional operation)- Specified by:
getClassMetadata
in interfaceEntityPersister
-
getMappedSuperclass
public String getMappedSuperclass()
Description copied from interface:Queryable
Get the class that this class is mapped as a subclass of - not necessarily the direct superclass- Specified by:
getMappedSuperclass
in interfaceQueryable
-
isExplicitPolymorphism
public boolean isExplicitPolymorphism()
Description copied from interface:Queryable
Is this class explicit polymorphism only?- Specified by:
isExplicitPolymorphism
in interfaceQueryable
-
useDynamicUpdate
protected boolean useDynamicUpdate()
-
useDynamicInsert
protected boolean useDynamicInsert()
-
hasEmbeddedCompositeIdentifier
protected boolean hasEmbeddedCompositeIdentifier()
-
canExtractIdOutOfEntity
public boolean canExtractIdOutOfEntity()
Description copied from interface:EntityPersister
Determine whether detached instances of this entity carry their own identifier value. The other option is the deprecated feature where users could supply the id during session calls.- Specified by:
canExtractIdOutOfEntity
in interfaceEntityPersister
- Returns:
- True if either (1)
EntityPersister.hasIdentifierProperty()
or (2) the identifier is an embedded composite identifier; false otherwise.
-
getKeyColumnNames
public String[] getKeyColumnNames()
Description copied from interface:Joinable
The columns to join on- Specified by:
getKeyColumnNames
in interfaceJoinable
-
getName
public String getName()
Description copied from interface:Joinable
An identifying name; a class name or collection role name.
-
isCollection
public boolean isCollection()
Description copied from interface:Joinable
Is this instance actually a CollectionPersister?- Specified by:
isCollection
in interfaceJoinable
-
consumesEntityAlias
public boolean consumesEntityAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Specified by:
consumesEntityAlias
in interfaceJoinable
- Returns:
- Does this persister "consume" entity column aliases in the result set?
-
consumesCollectionAlias
public boolean consumesCollectionAlias()
Description copied from interface:Joinable
Very, very, very ugly...- Specified by:
consumesCollectionAlias
in interfaceJoinable
- Returns:
- Does this persister "consume" collection column aliases in the result set?
-
getPropertyType
public Type getPropertyType(String propertyName) throws MappingException
Get the type of a particular property by name. Warning: When there are duplicated property names in the subclasses then this method may return the wrong results. To ensure correct results, this method should only be used when this is the concrete EntityPersister (since the concrete EntityPersister cannot have duplicated property names).- Specified by:
getPropertyType
in interfaceClassMetadata
- Specified by:
getPropertyType
in 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:PropertyMapping
Get the type of the thing containing the properties- Specified by:
getType
in interfacePropertyMapping
- Specified by:
getType
in interfaceSQLLoadable
-
isSelectBeforeUpdateRequired
public boolean isSelectBeforeUpdateRequired()
Description copied from interface:EntityPersister
Is select snapshot before update enabled?- Specified by:
isSelectBeforeUpdateRequired
in interfaceEntityPersister
-
optimisticLockStyle
protected final OptimisticLockStyle optimisticLockStyle()
-
createProxy
public Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Create a new proxy instance- Specified by:
createProxy
in interfaceEntityPersister
- Throws:
HibernateException
-
selectFragment
public final String selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
Description copied from interface:Joinable
All columns to select, when loading.- Specified by:
selectFragment
in interfaceJoinable
-
isInstrumented
public boolean isInstrumented()
Description copied from interface:EntityPersister
Has the class actually been bytecode instrumented?- Specified by:
isInstrumented
in interfaceEntityPersister
-
hasInsertGeneratedProperties
public boolean hasInsertGeneratedProperties()
Description copied from interface:EntityPersister
Does this entity define any properties as being database generated on insert?- Specified by:
hasInsertGeneratedProperties
in 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:EntityPersister
Does this entity define any properties as being database generated on update?- Specified by:
hasUpdateGeneratedProperties
in 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:EntityPersister
Does this entity contain a version property that is defined to be database generated?- Specified by:
isVersionPropertyGenerated
in 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:Queryable
Is the version property included in insert statements?- Specified by:
isVersionPropertyInsertable
in interfaceQueryable
-
afterInitialize
public void afterInitialize(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Called just after the entities properties have been initialized- Specified by:
afterInitialize
in interfaceEntityPersister
-
getPropertyNames
public String[] getPropertyNames()
Description copied from interface:EntityPersister
Get 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:
getPropertyNames
in interfaceClassMetadata
- Specified by:
getPropertyNames
in interfaceEntityPersister
-
getPropertyTypes
public Type[] getPropertyTypes()
Description copied from interface:EntityPersister
Get the Hibernate types of the class properties- Specified by:
getPropertyTypes
in interfaceClassMetadata
- Specified by:
getPropertyTypes
in interfaceEntityPersister
-
getPropertyLaziness
public boolean[] getPropertyLaziness()
Description copied from interface:ClassMetadata
Get the "laziness" of the properties of this class- Specified by:
getPropertyLaziness
in interfaceClassMetadata
- Specified by:
getPropertyLaziness
in interfaceEntityPersister
-
getPropertyUpdateability
public boolean[] getPropertyUpdateability()
Description copied from interface:EntityPersister
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE)- Specified by:
getPropertyUpdateability
in interfaceEntityPersister
-
getPropertyCheckability
public boolean[] getPropertyCheckability()
Description copied from interface:EntityPersister
Get the "checkability" of the properties of this class (is the property dirty checked, does the cache need to be updated)- Specified by:
getPropertyCheckability
in interfaceEntityPersister
-
getNonLazyPropertyUpdateability
public boolean[] getNonLazyPropertyUpdateability()
-
getPropertyInsertability
public boolean[] getPropertyInsertability()
Description copied from interface:EntityPersister
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT)- Specified by:
getPropertyInsertability
in interfaceEntityPersister
-
getPropertyInsertGenerationInclusions
@Deprecated public ValueInclusion[] getPropertyInsertGenerationInclusions()
Deprecated.no simple, direct replacementDescription copied from interface:EntityPersister
Which of the properties of this class are database generated values on insert?- Specified by:
getPropertyInsertGenerationInclusions
in interfaceEntityPersister
-
getPropertyUpdateGenerationInclusions
@Deprecated public ValueInclusion[] getPropertyUpdateGenerationInclusions()
Deprecated.no simple, direct replacementDescription copied from interface:EntityPersister
Which of the properties of this class are database generated values on update?- Specified by:
getPropertyUpdateGenerationInclusions
in interfaceEntityPersister
-
getPropertyNullability
public boolean[] getPropertyNullability()
Description copied from interface:EntityPersister
Get the nullability of the properties of this class- Specified by:
getPropertyNullability
in interfaceClassMetadata
- Specified by:
getPropertyNullability
in interfaceEntityPersister
-
getPropertyVersionability
public boolean[] getPropertyVersionability()
Description copied from interface:EntityPersister
Get the "versionability" of the properties of this class (is the property optimistic-locked)- Specified by:
getPropertyVersionability
in interfaceEntityPersister
-
getPropertyCascadeStyles
public CascadeStyle[] getPropertyCascadeStyles()
Description copied from interface:EntityPersister
Get the cascade styles of the properties (optional operation)- Specified by:
getPropertyCascadeStyles
in interfaceEntityPersister
-
getMappedClass
public final Class getMappedClass()
Description copied from interface:EntityPersister
The persistent class, or null- Specified by:
getMappedClass
in interfaceClassMetadata
- Specified by:
getMappedClass
in interfaceEntityPersister
-
implementsLifecycle
public boolean implementsLifecycle()
Description copied from interface:EntityPersister
Does the class implement theLifecycle
interface.- Specified by:
implementsLifecycle
in interfaceClassMetadata
- Specified by:
implementsLifecycle
in interfaceEntityPersister
-
getConcreteProxyClass
public Class getConcreteProxyClass()
Description copied from interface:EntityPersister
Get the proxy interface that instances of this concrete class will be cast to (optional operation).- Specified by:
getConcreteProxyClass
in interfaceEntityPersister
-
setPropertyValues
public void setPropertyValues(Object object, Object[] values)
Description copied from interface:EntityPersister
Set the given values to the mapped properties of the given object- Specified by:
setPropertyValues
in interfaceClassMetadata
- Specified by:
setPropertyValues
in interfaceEntityPersister
-
setPropertyValue
public void setPropertyValue(Object object, int i, Object value)
Description copied from interface:EntityPersister
Set the value of a particular property- Specified by:
setPropertyValue
in interfaceEntityPersister
-
getPropertyValues
public Object[] getPropertyValues(Object object)
Description copied from interface:EntityPersister
Return the (loaded) values of the mapped properties of the object (not including backrefs)- Specified by:
getPropertyValues
in interfaceClassMetadata
- Specified by:
getPropertyValues
in interfaceEntityPersister
- Parameters:
object
- The entity from which to extract the property values.- Returns:
- The property values.
-
getPropertyValue
public Object getPropertyValue(Object object, int i)
Description copied from interface:EntityPersister
Get the value of a particular property- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getPropertyValue
public Object getPropertyValue(Object object, String propertyName)
Description copied from interface:EntityPersister
Get the value of a particular property- Specified by:
getPropertyValue
in interfaceClassMetadata
- Specified by:
getPropertyValue
in interfaceEntityPersister
-
getIdentifier
public Serializable getIdentifier(Object object)
Description copied from interface:EntityPersister
Get the identifier of an instance (throw an exception if no identifier property)- Specified by:
getIdentifier
in interfaceClassMetadata
- Specified by:
getIdentifier
in interfaceEntityPersister
-
getIdentifier
public Serializable getIdentifier(Object entity, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Get the identifier of an instance (throw an exception if no identifier property)- Specified by:
getIdentifier
in interfaceClassMetadata
- Specified by:
getIdentifier
in 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(Object entity, Serializable id, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Inject the identifier value into the given entity.- Specified by:
setIdentifier
in interfaceClassMetadata
- Specified by:
setIdentifier
in 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 Object getVersion(Object object)
Description copied from interface:EntityPersister
Get the version number (or timestamp) from the object's version property (or return null if not versioned)- Specified by:
getVersion
in interfaceClassMetadata
- Specified by:
getVersion
in interfaceEntityPersister
-
instantiate
public Object instantiate(Serializable id, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Create a class instance initialized with the given identifier- Specified by:
instantiate
in interfaceClassMetadata
- Specified by:
instantiate
in 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(Object object)
Description copied from interface:EntityPersister
Is the given object an instance of this entity?- Specified by:
isInstance
in interfaceEntityPersister
-
hasUninitializedLazyProperties
public boolean hasUninitializedLazyProperties(Object object)
Description copied from interface:EntityPersister
Does the given instance have any uninitialized lazy properties?- Specified by:
hasUninitializedLazyProperties
in interfaceEntityPersister
-
resetIdentifier
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Set the identifier and version of the given instance back to its "unsaved" value.- Specified by:
resetIdentifier
in 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(Object instance, SessionFactoryImplementor factory)
Description copied from interface:EntityPersister
A request has already identified the entity-name of this persister as the mapping for the given instance. However, we still need to account for possible subclassing and potentially re-route to the more appropriate persister. For example, a request names Animal as the entity-name which gets resolved to this persister. But the actual instance is really an instance of Cat which is a subclass of Animal. So, here the Animal persister is being asked to return the persister specific to Cat. It is also possible that the instance is actually an Animal instance in the above example in which case we would return this from this method.- Specified by:
getSubclassEntityPersister
in interfaceEntityPersister
- Parameters:
instance
- The entity instancefactory
- Reference to the SessionFactory- Returns:
- The appropriate persister
-
isMultiTable
public boolean isMultiTable()
Description copied from interface:Queryable
Is the inheritance hierarchy described by this persister contained across multiple tables?- Specified by:
isMultiTable
in interfaceQueryable
- Returns:
- True if the inheritance hierarchy is spread across multiple tables; false otherwise.
-
getPropertySpan
protected int getPropertySpan()
-
getPropertyValuesToInsert
public Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Return the values of the insertable properties of the object (including backrefs)- Specified by:
getPropertyValuesToInsert
in interfaceClassMetadata
- Specified by:
getPropertyValuesToInsert
in interfaceEntityPersister
- Throws:
HibernateException
-
processInsertGeneratedProperties
public void processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to 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:
processInsertGeneratedProperties
in interfaceEntityPersister
- Parameters:
id
- The entity's id value.entity
- The entity for which to get the state.session
- The session
-
processUpdateGeneratedProperties
public void processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Perform a select to retrieve the values of any generated properties back from the database, injecting these generated values into the given entity as well as writing this state to 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:
processUpdateGeneratedProperties
in interfaceEntityPersister
- Parameters:
id
- The entity's id value.entity
- The entity for which to get the state.session
- The session
-
getIdentifierPropertyName
public String getIdentifierPropertyName()
Description copied from interface:EntityPersister
Get the name of the identifier property (or return null) - need not return the name of an actual Java property- Specified by:
getIdentifierPropertyName
in interfaceClassMetadata
- Specified by:
getIdentifierPropertyName
in interfaceEntityPersister
-
getIdentifierType
public Type getIdentifierType()
Description copied from interface:EntityPersister
Get the identifier type- Specified by:
getIdentifierType
in interfaceClassMetadata
- Specified by:
getIdentifierType
in interfaceEntityPersister
-
hasSubselectLoadableCollections
public boolean hasSubselectLoadableCollections()
Description copied from interface:EntityPersister
Determine whether this entity contains references to persistent collections which are fetchable by subselect?- Specified by:
hasSubselectLoadableCollections
in interfaceEntityPersister
- Returns:
- True if the entity contains collections fetchable by subselect; false otherwise.
-
getNaturalIdentifierProperties
public int[] getNaturalIdentifierProperties()
Description copied from interface:EntityPersister
If the entity defines a natural id (EntityPersister.hasNaturalIdentifier()
), which properties make up the natural id.- Specified by:
getNaturalIdentifierProperties
in interfaceClassMetadata
- Specified by:
getNaturalIdentifierProperties
in interfaceEntityPersister
- Returns:
- The indices of the properties making of the natural id; or null, if no natural id is defined.
-
getNaturalIdentifierSnapshot
public Object[] getNaturalIdentifierSnapshot(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:EntityPersister
Retrieve the current state of the natural-id properties from the database.- Specified by:
getNaturalIdentifierSnapshot
in 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
public Serializable loadEntityIdByNaturalId(Object[] naturalIdValues, LockOptions lockOptions, SharedSessionContractImplementor session)
Description copied from interface:EntityPersister
Load the id for the entity based on the natural id.- Specified by:
loadEntityIdByNaturalId
in interfaceEntityPersister
-
isNaturalIdNonNullable
protected boolean isNaturalIdNonNullable()
-
concretePropertySelectFragmentSansLeadingComma
protected String concretePropertySelectFragmentSansLeadingComma(String alias, boolean[] include)
-
hasNaturalIdentifier
public boolean hasNaturalIdentifier()
Description copied from interface:EntityPersister
Determine whether this entity defines a natural identifier.- Specified by:
hasNaturalIdentifier
in interfaceClassMetadata
- Specified by:
hasNaturalIdentifier
in interfaceEntityPersister
- Returns:
- True if the entity defines a natural id; false otherwise.
-
setPropertyValue
public void setPropertyValue(Object object, String propertyName, Object value)
Description copied from interface:ClassMetadata
Set the value of a particular (named) property- Specified by:
setPropertyValue
in interfaceClassMetadata
-
getEntityMode
public EntityMode getEntityMode()
- Specified by:
getEntityMode
in interfaceEntityPersister
-
getEntityTuplizer
public EntityTuplizer getEntityTuplizer()
- Specified by:
getEntityTuplizer
in interfaceEntityPersister
-
getInstrumentationMetadata
public BytecodeEnhancementMetadata getInstrumentationMetadata()
- Specified by:
getInstrumentationMetadata
in interfaceEntityPersister
-
getBytecodeEnhancementMetadata
public BytecodeEnhancementMetadata getBytecodeEnhancementMetadata()
- Specified by:
getBytecodeEnhancementMetadata
in interfaceEntityPersister
-
getTableAliasForColumn
public String getTableAliasForColumn(String columnName, String rootAlias)
Description copied from interface:Loadable
Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias for the table in that hierarchy that contains said column. NOTE : Generally speaking the column is not validated to exist. Most implementations simply return the root alias; the exception isJoinedSubclassEntityPersister
- Specified by:
getTableAliasForColumn
in interfaceLoadable
- Parameters:
columnName
- The column namerootAlias
- The hierarchy root alias- Returns:
- The proper table alias for qualifying the given column.
-
determineTableNumberForColumn
public int determineTableNumberForColumn(String columnName)
-
determineTableName
protected String determineTableName(Table table, JdbcEnvironment jdbcEnvironment)
-
getEntityEntryFactory
public EntityEntryFactory getEntityEntryFactory()
Description copied from interface:EntityPersister
Get the EntityEntryFactory indicated for the entity mapped by this persister.- Specified by:
getEntityEntryFactory
in interfaceEntityPersister
- Returns:
- The proper EntityEntryFactory.
-
generateEntityDefinition
public void generateEntityDefinition()
Description copied from interface:EntityPersister
Generate the entity definition for this object. This must be done for all entity persisters before callingEntityPersister.postInstantiate()
.- Specified by:
generateEntityDefinition
in interfaceEntityPersister
-
getEntityPersister
public EntityPersister getEntityPersister()
- Specified by:
getEntityPersister
in interfaceEntityDefinition
-
getEntityKeyDefinition
public EntityIdentifierDefinition getEntityKeyDefinition()
- Specified by:
getEntityKeyDefinition
in interfaceEntityDefinition
-
getAttributes
public Iterable<AttributeDefinition> getAttributes()
- Specified by:
getAttributes
in interfaceAttributeSource
-
-