Package org.hibernate.metadata
Interface ClassMetadata
- All Known Implementing Classes:
AbstractEntityPersister,JoinedSubclassEntityPersister,SingleTableEntityPersister,UnionSubclassEntityPersister
public interface ClassMetadata
Exposes entity class metadata to the application
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThe name of the entitygetIdentifier(Object entity, SessionImplementor session) Get the identifier of an instance (throw an exception if no identifier property)getIdentifier(Object object, EntityMode entityMode) Deprecated.Get the name of the identifier property (or return null)Get the identifier Hibernate typegetMappedClass(EntityMode entityMode) The persistent class, or nullint[]Which properties hold the natural id?boolean[]Get the "laziness" of the properties of this classString[]Get the names of the class' persistent propertiesboolean[]Get the nullability of the class' persistent propertiesgetPropertyType(String propertyName) Get the type of a particular (named) propertyType[]Get the Hibernate types of the class propertiesgetPropertyValue(Object object, String propertyName, EntityMode entityMode) Get the value of a particular (named) propertyObject[]getPropertyValues(Object entity, EntityMode entityMode) Extract the property values from the given entity.Object[]getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) Return the values of the mapped properties of the objectgetVersion(Object object, EntityMode entityMode) Get the version number (or timestamp) from the object's version property (or return null if not versioned)intGet the index of the version propertybooleanDoes this class have an identifier property?booleanDoes this entity declare a natural id?booleanhasProxy()Does this class support dynamic proxies?booleanDoes this entity have mapped subclasses?booleanimplementsLifecycle(EntityMode entityMode) Does the class implement the Lifecycle interface?booleanimplementsValidatable(EntityMode entityMode) Does the class implement the Validatable interface?instantiate(Serializable id, SessionImplementor session) Create a class instance initialized with the given identifierinstantiate(Serializable id, EntityMode entityMode) Deprecated.Useinstantiate(Serializable, SessionImplementor)insteadbooleanDoes this entity extend a mapped superclass?booleanAre instances of this class mutable?booleanAre instances of this class versioned by a timestamp or version number column?voidsetIdentifier(Object entity, Serializable id, SessionImplementor session) Inject the identifier value into the given entity.voidsetIdentifier(Object entity, Serializable id, EntityMode entityMode) Deprecated.voidsetPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode) Set the value of a particular (named) propertyvoidsetPropertyValues(Object object, Object[] values, EntityMode entityMode) Set the given values to the mapped properties of the given object
-
Method Details
-
getEntityName
String getEntityName()The name of the entity -
getIdentifierPropertyName
String getIdentifierPropertyName()Get the name of the identifier property (or return null) -
getPropertyNames
String[] getPropertyNames()Get the names of the class' persistent properties -
getIdentifierType
Type getIdentifierType()Get the identifier Hibernate type -
getPropertyTypes
Type[] getPropertyTypes()Get the Hibernate types of the class properties -
getPropertyType
Get the type of a particular (named) property- Throws:
HibernateException
-
hasProxy
boolean hasProxy()Does this class support dynamic proxies? -
isMutable
boolean isMutable()Are instances of this class mutable? -
isVersioned
boolean isVersioned()Are instances of this class versioned by a timestamp or version number column? -
getVersionProperty
int getVersionProperty()Get the index of the version property -
getPropertyNullability
boolean[] getPropertyNullability()Get the nullability of the class' persistent properties -
getPropertyLaziness
boolean[] getPropertyLaziness()Get the "laziness" of the properties of this class -
hasIdentifierProperty
boolean hasIdentifierProperty()Does this class have an identifier property? -
hasNaturalIdentifier
boolean hasNaturalIdentifier()Does this entity declare a natural id? -
getNaturalIdentifierProperties
int[] getNaturalIdentifierProperties()Which properties hold the natural id? -
hasSubclasses
boolean hasSubclasses()Does this entity have mapped subclasses? -
isInherited
boolean isInherited()Does this entity extend a mapped superclass? -
getPropertyValuesToInsert
Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException Return the values of the mapped properties of the object- Throws:
HibernateException
-
getMappedClass
The persistent class, or null -
instantiate
Deprecated.Useinstantiate(Serializable, SessionImplementor)insteadCreate a class instance initialized with the given identifier- Throws:
HibernateException
-
instantiate
Create a class instance initialized with the given identifier- 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.
-
getPropertyValue
Object getPropertyValue(Object object, String propertyName, EntityMode entityMode) throws HibernateException Get the value of a particular (named) property- Throws:
HibernateException
-
getPropertyValues
Extract the property values from the given entity.- Parameters:
entity- The entity from which to extract the property values.entityMode- The entity-mode of the given entity- Returns:
- The property values.
- Throws:
HibernateException
-
setPropertyValue
void setPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode) throws HibernateException Set the value of a particular (named) property- Throws:
HibernateException
-
setPropertyValues
void setPropertyValues(Object object, Object[] values, EntityMode entityMode) throws HibernateException Set the given values to the mapped properties of the given object- Throws:
HibernateException
-
getIdentifier
Deprecated.UsegetIdentifier(Object,SessionImplementor)insteadGet the identifier of an instance (throw an exception if no identifier property)- Throws:
HibernateException
-
getIdentifier
Get the identifier of an instance (throw an exception if no identifier property)- Parameters:
entity- The entity for which to get the identifiersession- The session from which the request originated- Returns:
- The identifier
-
setIdentifier
Deprecated.Inject the identifier value into the given entity. Has no effect if the entity does not define an identifier property- Parameters:
entity- The entity to inject with the identifier value.id- The value to be injected as the identifier.entityMode- The entity mode- Throws:
HibernateException
-
setIdentifier
Inject the identifier value into the given entity.- 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
-
implementsLifecycle
Does the class implement the Lifecycle interface? -
implementsValidatable
Does the class implement the Validatable interface? -
getVersion
Get the version number (or timestamp) from the object's version property (or return null if not versioned)- Throws:
HibernateException
-
getIdentifier(Object,SessionImplementor)instead