|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.hibernate.persister.AbstractPropertyMapping net.sf.hibernate.persister.AbstractEntityPersister
Superclass for built-in mapping strategies. Implements functionality
common to both mapping strategies.
May be considered an immutable view of the mapping object.
Field Summary | |
static String |
ENTITY_CLASS
|
Fields inherited from interface net.sf.hibernate.persister.ClassPersister |
ENTITY_ID |
Constructor Summary | |
protected |
AbstractEntityPersister(PersistentClass model,
SessionFactoryImplementor factory)
|
Method Summary | |
protected void |
check(int rows,
Serializable id)
|
protected void |
checkColumnDuplication(Set distinctColumns,
Iterator columns)
|
boolean |
consumesAlias()
Ugly, very ugly.... |
protected JDBCException |
convert(SQLException sqlException,
String message)
|
protected UniqueEntityLoader |
createEntityLoader(SessionFactoryImplementor factory)
|
Object |
createProxy(Serializable id,
SessionImplementor session)
Create a new proxy instance |
protected ProxyFactory |
createProxyFactory()
Create a new ProxyFactory. |
protected void |
createUniqueKeyLoaders(SessionFactoryImplementor factory)
|
int[] |
findDirty(Object[] x,
Object[] y,
Object object,
SessionImplementor session)
Determine if the given field values are dirty |
int[] |
findModified(Object[] old,
Object[] current,
Object object,
SessionImplementor session)
Determine if the given field values are dirty |
protected abstract String |
generateLockString()
|
protected String |
generateSelectVersionString()
Generate the SQL that selects the version number by id |
protected abstract String[] |
getActualPropertyColumnNames(int i)
|
CacheConcurrencyStrategy |
getCache()
Get the cache (optional operation) |
ClassMetadata |
getClassMetadata()
Get the user-visible metadata for the class (optional operation) |
String |
getClassName()
The classname of the persistent class (used only for messages) |
Class |
getConcreteProxyClass()
Get the proxy interface that instances of this concrete class will be cast to (optional operation). |
protected abstract String |
getConcreteSelectString()
|
Object[] |
getCurrentPersistentState(Serializable id,
Object version,
SessionImplementor session)
Get the current database state of the object, in a "hydrated" form, without resolving identifiers |
Object |
getCurrentVersion(Serializable id,
SessionImplementor session)
Retrieve the version number |
protected Dialect |
getDialect()
|
protected abstract String |
getDiscriminatorAlias()
|
String |
getDiscriminatorAlias(String suffix)
Get the result set aliases used for the identifier columns, given a suffix |
protected abstract String |
getFormulaTemplate(int i)
|
protected Serializable |
getGeneratedIdentity(Object object,
SessionImplementor session,
ResultSet rs)
Get the generated identifier when using identity columns |
protected Getter[] |
getGetters()
|
protected int |
getHydrateSpan()
|
Serializable |
getIdentifier(Object object)
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 suffix |
String[] |
getIdentifierColumnNames()
Get the names of columns used to persist the identifier |
IdentifierGenerator |
getIdentifierGenerator()
Return the IdentifierGenerator for the class |
String |
getIdentifierPropertyName()
Get the name of the identifier property (or return null) |
Serializable |
getIdentifierSpace()
Returns an object that identifies the space in which identifiers of this class hierarchy are unique. |
Type |
getIdentifierType()
Get the identifier Hibernate type |
String[] |
getJoinKeyColumnNames()
The columns to join on. |
Class |
getMappedClass()
The persistent class |
Class |
getMappedSuperclass()
Get the class that this class is mapped as a subclass of - not necessarily the direct superclass |
String |
getName()
An identifying name; a class name or collection role name. |
boolean[] |
getNotNullInsertableColumns(Object[] fields)
|
protected boolean[] |
getPropertiesToUpdate(int[] dirtyProperties)
Transform the array of property indexes to an array of booleans |
String[] |
getPropertyAliases(String suffix,
int i)
Get the result set aliases used for the property columns, given a suffix (properties of this class, only). |
Cascades.CascadeStyle[] |
getPropertyCascadeStyles()
Get the cascade styles of the propertes (optional operation) |
protected abstract String[] |
getPropertyColumnNames(int i)
Get the column names for the numbered property of this class |
boolean[] |
getPropertyInsertability()
Get the "insertability" of the properties of this class (does the property appear in an SQL INSERT) |
String[] |
getPropertyNames()
Get the names of the class' persistent properties |
boolean[] |
getPropertyNullability()
Get the nullability of the class' persistent properties |
Type |
getPropertyType(String propertyName)
Get the type of a particular (named) property |
Type[] |
getPropertyTypes()
Get the Hibernate types of the class properties |
boolean[] |
getPropertyUpdateability()
Get the "updateability" of the properties of this class (does the property appear in an SQL UPDATE) |
Object |
getPropertyValue(Object object,
int i)
Get the value of the numbered property |
Object |
getPropertyValue(Object object,
String propertyName)
Get the value of a particular (named) property |
Object[] |
getPropertyValues(Object object)
Return the values of the mapped properties of the object |
protected Setter[] |
getSetters()
|
protected String |
getSQLWhereString(String alias)
|
String[] |
getSubclassPropertyColumnAliases(String propertyName,
String suffix)
Return the column alias names used to persist/query the numbered property of the class or a subclass (optional operation). |
Type |
getType()
Get the type |
String[] |
getUniqueKeyColumnNames(String propertyName)
Get the columns of the unique key. |
Object |
getVersion(Object object)
Get the version number (or timestamp) from the object's version property (or return null if not versioned) |
String |
getVersionColumnName()
|
protected abstract String |
getVersionedTableName()
|
int |
getVersionProperty()
Get the index of the version property |
protected abstract String |
getVersionSelectString()
|
VersionType |
getVersionType()
Get the type of versioning (optional operation) |
boolean |
hasCache()
Does this class have a cache. |
boolean |
hasCascades()
Does this class declare any cascading save/update/deletes. |
boolean |
hasCollections()
Do instances of this class contain collections. |
protected boolean |
hasEmbeddedIdentifier()
|
boolean |
hasIdentifierProperty()
Does this class have an identifier property? |
boolean |
hasIdentifierPropertyOrEmbeddedCompositeIdentifier()
Do detached instances of this class carry their own identifier value? |
boolean |
hasProxy()
Does this class support dynamic proxies? |
protected boolean |
hasSelectBeforeUpdate()
|
boolean |
hasSubclasses()
Does this persistent class have subclasses? |
protected boolean |
hasWhere()
|
String |
identifierSelectFragment(String name,
String suffix)
Given a query alias and an identifying suffix, render the intentifier select fragment. |
boolean |
implementsLifecycle()
Does the class implement the Lifecycle interface? |
boolean |
implementsValidatable()
Does the class implement the Validatable interface? |
protected void |
initLockers()
|
protected void |
initPropertyPaths(SessionFactoryImplementor factory)
|
protected void |
initSubclassPropertyAliasesMap(PersistentClass model)
Must be called by subclasses, at the end of their constructors |
Object |
instantiate(Serializable id)
Return a new instance initialized with the given identifier |
boolean |
isBatchable()
|
boolean |
isBatchLoadable()
Is batch loading enabled? |
boolean |
isCollection()
Is this instance actually a CollectionPersister? |
boolean |
isExplicitPolymorphism()
Is this class explicit polymorphism only? |
boolean |
isIdentifierAssignedByInsert()
Is the identifier assigned before the insert by an IDGenerator. |
boolean |
isInherited()
Is this class mapped as a subclass of another class? |
boolean |
isManyToMany()
Is this instance actually a many-to-many association? |
boolean |
isMutable()
Are instances of this class mutable? |
boolean |
isPolymorphic()
|
boolean |
isUnsaved(Object object)
Is this a new transient instance? |
boolean |
isVersioned()
Are instances of this class versioned by a timestamp or version number column? |
Object |
loadByUniqueKey(String propertyName,
Serializable uniqueKey,
SessionImplementor session)
Load an instance of the persistent class, by a unique key other than the primary key. |
void |
lock(Serializable id,
Object version,
Object object,
LockMode lockMode,
SessionImplementor session)
Do a version check |
protected int |
optimisticLockMode()
|
String |
selectFragment(String alias,
String suffix)
Generate a list of collection index and element columns |
String |
selectFragment(String alias,
String suffix,
boolean includeCollectionColumns)
All columns to select, when loading. |
void |
setIdentifier(Object object,
Serializable id)
Set the identifier of an instance (or do nothing if no identifier property) |
void |
setPropertyValue(Object object,
int i,
Object value)
Set the value of the numbered property |
void |
setPropertyValue(Object object,
String propertyName,
Object value)
Set the value of a particular (named) property |
void |
setPropertyValues(Object object,
Object[] values)
Set the given values to the mapped properties of the given object |
protected String |
sqlIdentitySelect()
The query that returns the generated identifier for an identity column |
String |
toString()
|
protected boolean |
useDynamicInsert()
|
protected boolean |
useDynamicUpdate()
|
Methods inherited from class net.sf.hibernate.persister.AbstractPropertyMapping |
addFormulaPropertyPath, addPropertyPath, handlePath, initComponentPropertyPaths, initIdentifierPropertyPaths, initPropertyPaths, initPropertyPaths, toColumns, toType |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.hibernate.persister.OuterJoinLoadable |
countSubclassProperties, enableJoinedFetch, fromTableFragment, getDiscriminatorColumnName, getSubclassPropertyColumnNames, getSubclassPropertyName, getSubclassPropertyTableName, getSubclassPropertyType, isDefinedOnSubclass, toColumns |
Methods inherited from interface net.sf.hibernate.persister.Loadable |
getDiscriminatorType, getSubclassForDiscriminatorValue |
Methods inherited from interface net.sf.hibernate.persister.ClassPersister |
delete, getPropertySpaces, insert, insert, isCacheInvalidationRequired, load, postInstantiate, update |
Methods inherited from interface net.sf.hibernate.persister.Joinable |
fromJoinFragment, getTableName, whereJoinFragment |
Methods inherited from interface net.sf.hibernate.persister.Queryable |
getDiscriminatorSQLValue, propertySelectFragment, queryWhereFragment |
Methods inherited from interface net.sf.hibernate.persister.PropertyMapping |
toColumns, toType |
Field Detail |
public static final String ENTITY_CLASS
Constructor Detail |
protected AbstractEntityPersister(PersistentClass model, SessionFactoryImplementor factory) throws HibernateException
Method Detail |
public final Class getMappedClass()
ClassMetadata
getMappedClass
in interface ClassPersister
public final String getClassName()
ClassPersister
getClassName
in interface ClassPersister
getClassName
in class AbstractPropertyMapping
public Serializable getIdentifierSpace()
ClassPersister
getIdentifierSpace
in interface ClassPersister
public String identifierSelectFragment(String name, String suffix)
Queryable
identifierSelectFragment
in interface Queryable
public Cascades.CascadeStyle[] getPropertyCascadeStyles()
ClassPersister
getPropertyCascadeStyles
in interface ClassPersister
public void setPropertyValues(Object object, Object[] values) throws HibernateException
setPropertyValues
in interface ClassPersister
HibernateException
public Object[] getPropertyValues(Object object) throws HibernateException
getPropertyValues
in interface ClassPersister
HibernateException
public Object getPropertyValue(Object object, int i) throws HibernateException
getPropertyValue
in interface ClassPersister
HibernateException
public void setPropertyValue(Object object, int i, Object value) throws HibernateException
setPropertyValue
in interface ClassPersister
HibernateException
public int[] findDirty(Object[] x, Object[] y, Object object, SessionImplementor session) throws HibernateException
findDirty
in interface ClassPersister
HibernateException
public int[] findModified(Object[] old, Object[] current, Object object, SessionImplementor session) throws HibernateException
findModified
in interface ClassPersister
HibernateException
public Serializable getIdentifier(Object object) throws HibernateException
ClassMetadata
getIdentifier
in interface ClassPersister
HibernateException
public Object getVersion(Object object) throws HibernateException
ClassMetadata
getVersion
in interface ClassPersister
HibernateException
public void setIdentifier(Object object, Serializable id) throws HibernateException
ClassMetadata
setIdentifier
in interface ClassPersister
HibernateException
public Object instantiate(Serializable id) throws HibernateException
instantiate
in interface ClassPersister
HibernateException
protected Setter[] getSetters()
protected Getter[] getGetters()
public Type[] getPropertyTypes()
ClassMetadata
getPropertyTypes
in interface ClassPersister
public Type getIdentifierType()
ClassMetadata
getIdentifierType
in interface ClassPersister
public String[] getIdentifierColumnNames()
OuterJoinLoadable
getIdentifierColumnNames
in interface OuterJoinLoadable
getIdentifierColumnNames
in class AbstractPropertyMapping
protected String[] getIdentifierAliases()
public boolean isPolymorphic()
public boolean isInherited()
Queryable
isInherited
in interface Queryable
public boolean hasCascades()
ClassPersister
hasCascades
in interface ClassPersister
public CacheConcurrencyStrategy getCache()
ClassPersister
getCache
in interface ClassPersister
public boolean hasIdentifierProperty()
ClassMetadata
hasIdentifierProperty
in interface ClassPersister
public VersionType getVersionType()
ClassPersister
getVersionType
in interface ClassPersister
public int getVersionProperty()
ClassMetadata
getVersionProperty
in interface ClassPersister
public boolean isVersioned()
ClassMetadata
isVersioned
in interface ClassPersister
public boolean isBatchable()
public boolean isIdentifierAssignedByInsert()
ClassPersister
isIdentifierAssignedByInsert
in interface ClassPersister
public boolean isUnsaved(Object object) throws HibernateException
ClassPersister
isUnsaved
in interface ClassPersister
HibernateException
public String[] getPropertyNames()
ClassMetadata
getPropertyNames
in interface ClassPersister
public String getIdentifierPropertyName()
ClassMetadata
getIdentifierPropertyName
in interface ClassPersister
public String getVersionColumnName()
public boolean implementsLifecycle()
ClassMetadata
implementsLifecycle
in interface ClassPersister
public boolean implementsValidatable()
ClassMetadata
implementsValidatable
in interface ClassPersister
public boolean hasCollections()
ClassPersister
hasCollections
in interface ClassPersister
public boolean isMutable()
ClassMetadata
isMutable
in interface ClassPersister
public boolean hasCache()
ClassPersister
hasCache
in interface ClassPersister
public boolean hasSubclasses()
Loadable
hasSubclasses
in interface Loadable
public boolean hasProxy()
ClassMetadata
hasProxy
in interface ClassPersister
protected final String sqlIdentitySelect()
public IdentifierGenerator getIdentifierGenerator() throws HibernateException
ClassPersister
getIdentifierGenerator
in interface ClassPersister
HibernateException
protected void check(int rows, Serializable id) throws HibernateException
HibernateException
protected abstract String[] getActualPropertyColumnNames(int i)
protected abstract String getFormulaTemplate(int i)
protected void initPropertyPaths(SessionFactoryImplementor factory) throws MappingException
MappingException
protected ProxyFactory createProxyFactory()
protected void initSubclassPropertyAliasesMap(PersistentClass model) throws MappingException
MappingException
protected void initLockers()
protected abstract String generateLockString()
public ClassMetadata getClassMetadata()
ClassPersister
getClassMetadata
in interface ClassPersister
public Class getConcreteProxyClass()
ClassPersister
getConcreteProxyClass
in interface ClassPersister
public Class getMappedSuperclass()
Queryable
getMappedSuperclass
in interface Queryable
public boolean isExplicitPolymorphism()
Queryable
isExplicitPolymorphism
in interface Queryable
public boolean[] getPropertyUpdateability()
ClassPersister
getPropertyUpdateability
in interface ClassPersister
public boolean[] getPropertyNullability()
ClassMetadata
getPropertyNullability
in interface ClassPersister
protected boolean useDynamicUpdate()
protected boolean useDynamicInsert()
public boolean[] getPropertyInsertability()
ClassPersister
getPropertyInsertability
in interface ClassPersister
public Object getPropertyValue(Object object, String propertyName) throws HibernateException
ClassMetadata
getPropertyValue
in interface ClassPersister
HibernateException
public void setPropertyValue(Object object, String propertyName, Object value) throws HibernateException
ClassMetadata
setPropertyValue
in interface ClassMetadata
HibernateException
protected boolean hasEmbeddedIdentifier()
public boolean[] getNotNullInsertableColumns(Object[] fields)
protected Dialect getDialect()
protected String getSQLWhereString(String alias)
protected boolean hasWhere()
public boolean hasIdentifierPropertyOrEmbeddedCompositeIdentifier()
ClassPersister
hasIdentifierPropertyOrEmbeddedCompositeIdentifier
in interface ClassPersister
protected void checkColumnDuplication(Set distinctColumns, Iterator columns) throws MappingException
MappingException
protected UniqueEntityLoader createEntityLoader(SessionFactoryImplementor factory) throws MappingException
MappingException
protected void createUniqueKeyLoaders(SessionFactoryImplementor factory) throws MappingException
MappingException
public Type getType()
SQLLoadable
getType
in interface PropertyMapping
protected int getHydrateSpan()
public boolean isBatchLoadable()
ClassPersister
isBatchLoadable
in interface ClassPersister
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix)
SQLLoadable
getSubclassPropertyColumnAliases
in interface SQLLoadable
public String[] getJoinKeyColumnNames()
Joinable
getJoinKeyColumnNames
in interface Joinable
public String getName()
Joinable
public String selectFragment(String alias, String suffix)
OuterJoinLoadable
selectFragment
in interface OuterJoinLoadable
public String[] getIdentifierAliases(String suffix)
Loadable
getIdentifierAliases
in interface Loadable
public String[] getPropertyAliases(String suffix, int i)
Loadable
getPropertyAliases
in interface Loadable
public String getDiscriminatorAlias(String suffix)
Loadable
getDiscriminatorAlias
in interface Loadable
protected abstract String getDiscriminatorAlias()
public Object loadByUniqueKey(String propertyName, Serializable uniqueKey, SessionImplementor session) throws HibernateException, SQLException
UniqueKeyLoadable
loadByUniqueKey
in interface UniqueKeyLoadable
HibernateException
SQLException
public String[] getUniqueKeyColumnNames(String propertyName)
UniqueKeyLoadable
getUniqueKeyColumnNames
in interface UniqueKeyLoadable
public boolean isCollection()
Joinable
isCollection
in interface Joinable
public boolean consumesAlias()
Joinable
consumesAlias
in interface Joinable
public Type getPropertyType(String propertyName) throws MappingException
ClassMetadata
getPropertyType
in interface ClassPersister
MappingException
protected boolean hasSelectBeforeUpdate()
protected abstract String getVersionSelectString()
public Object getCurrentVersion(Serializable id, SessionImplementor session) throws HibernateException
getCurrentVersion
in interface ClassPersister
HibernateException
public void lock(Serializable id, Object version, Object object, LockMode lockMode, SessionImplementor session) throws HibernateException
lock
in interface ClassPersister
HibernateException
protected Serializable getGeneratedIdentity(Object object, SessionImplementor session, ResultSet rs) throws SQLException, HibernateException, IdentifierGenerationException
public Object[] getCurrentPersistentState(Serializable id, Object version, SessionImplementor session) throws HibernateException
ClassPersister
getCurrentPersistentState
in interface ClassPersister
HibernateException
protected abstract String getVersionedTableName()
protected String generateSelectVersionString()
protected abstract String getConcreteSelectString()
protected final int optimisticLockMode()
public boolean isManyToMany()
Joinable
isManyToMany
in interface Joinable
public Object createProxy(Serializable id, SessionImplementor session) throws HibernateException
ClassPersister
createProxy
in interface ClassPersister
HibernateException
protected final boolean[] getPropertiesToUpdate(int[] dirtyProperties)
public String toString()
protected abstract String[] getPropertyColumnNames(int i)
public final String selectFragment(String alias, String suffix, boolean includeCollectionColumns)
Joinable
selectFragment
in interface Joinable
protected JDBCException convert(SQLException sqlException, String message)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |