Top Description Methods
org.hibernate.metamodel.spi

public Interface MetamodelImplementor

extends Metamodel
Known Direct Implementers
org.hibernate.metamodel.internal.MetamodelImpl
Imports
java.util.Collection, .List, .Map, .Set, javax.persistence.EntityGraph, org.hibernate.EntityNameResolver, .MappingException, .Metamodel, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.metamodel.model.domain.spi.EmbeddedTypeDescriptor, .EntityTypeDescriptor, .ManagedTypeDescriptor, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.type.spi.TypeConfiguration

Hibernate extension to the JPA Metamodel contract
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public <T> void
addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)

public <T> void
public void
public CollectionPersister

Returns:

The persister
collectionPersister
(String
The role of the collection for which to retrieve the persister.
role
)

Get the persister object for a collection role.

public Map<String, CollectionPersister>

Returns:

The Map contains all collection persisters.
collectionPersisters
()

Get all collection persisters as a Map, which collection role as the key and the persister is the value.

public <X> EmbeddedTypeDescriptor<X>
embeddable(Class<X>
the type of the represented embeddable class
cls
)

Redeclares javax.persistence.metamodel.Metamodel.embeddable.

Return the metamodel embeddable type representing the embeddable class.
public <X> EntityTypeDescriptor<X>
entity(String
The entity-name
entityName
)

Redeclares org.hibernate.Metamodel.entity.

Access to an entity supporting Hibernate's entity-name feature
public <X> EntityTypeDescriptor<X>
entity(Class<X>
the type of the represented entity
cls
)

Redeclares javax.persistence.metamodel.Metamodel.entity.

Return the metamodel entity type representing the entity.
public EntityPersister

Returns:

The entity persister
entityPersister
(Class<T>
The entity class
entityClass
)

Locate the persister for an entity by the entity class.

public EntityPersister

Returns:

The persister
entityPersister
(String
The name of the entity for which to retrieve the persister.
entityName
)

Locate the persister for an entity by the entity-name

public Map<String, EntityPersister>

Returns:

The Map contains all entity persisters.
entityPersisters
()

Get all entity persisters as a Map, which entity name its the key and the persister is the value.

public <T> RootGraphImplementor<T>
public <T> List<RootGraphImplementor<? super T>>
public default <T> List<EntityGraph<? super T>>
findEntityGraphsByType(Class<T> entityClass)

Deprecated Use findEntityGraphsByJavaType(Class) instead.
public String[]

Returns:

All of the entity names
getAllCollectionRoles
()

Get the names of all collections known to this Metamodel

public String[]

Returns:

All of the entity names
getAllEntityNames
()

Get the names of all entities known to this Metamodel

public Set<String>

Returns:

set of all the collection roles in which the given entityName participates.
getCollectionRolesByEntityParticipant
(String
The entity name for which to get the collection roles.
entityName
)

Retrieves a set of all the collection roles in which the given entity is a participant, as either an index or an element.

public Collection<EntityNameResolver>
public default EntityTypeDescriptor<J>
public SessionFactoryImplementor
getSessionFactory()

Redeclares org.hibernate.Metamodel.getSessionFactory.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Access to the SessionFactory that this Metamodel instance is bound to.
public TypeConfiguration

Returns:

Access to the TypeConfiguration
getTypeConfiguration
()

Access to the TypeConfiguration in effect for this SessionFactory/Metamodel

public EntityPersister

Returns:

The located EntityPersister, never null
locateEntityPersister
(Class<T>
The concrete Class or proxy interface for the entity to locate the persister for.
byClass
)

Locate an EntityPersister by the entity class.

public EntityPersister

Returns:

The located EntityPersister, never null
locateEntityPersister
(String
The entity name
byName
)

Locate the entity persister by name.

public <X> ManagedTypeDescriptor<X>
managedType(Class<X>
the type of the represented managed class
cls
)

Redeclares javax.persistence.metamodel.Metamodel.managedType.

Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.
Inherited from org.hibernate.Metamodel:
getImplementorsgetImportedClassName

Method Detail

addNamedEntityGraphback to summary
public <T> void addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph)
addNamedEntityGraphback to summary
public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph)
Annotations
@Deprecated
closeback to summary
public void close()
collectionPersisterback to summary
public CollectionPersister collectionPersister(String role)

Get the persister object for a collection role.

Parameters
role:String

The role of the collection for which to retrieve the persister.

Returns:CollectionPersister

The persister

Exceptions
MappingException:
Indicates persister could not be found with that role.
collectionPersistersback to summary
public Map<String, CollectionPersister> collectionPersisters()

Get all collection persisters as a Map, which collection role as the key and the persister is the value.

Returns:Map<String, CollectionPersister>

The Map contains all collection persisters.

embeddableback to summary
public <X> EmbeddedTypeDescriptor<X> embeddable(Class<X> cls)

Redeclares javax.persistence.metamodel.Metamodel.embeddable.

Doc from javax.persistence.metamodel.Metamodel.embeddable.

Return the metamodel embeddable type representing the embeddable class.

Parameters
cls:Class<X>

the type of the represented embeddable class

Returns:EmbeddedTypeDescriptor<X>

the metamodel embeddable type

Annotations
@Override
entityback to summary
public <X> EntityTypeDescriptor<X> entity(String entityName)

Redeclares org.hibernate.Metamodel.entity.

Doc from org.hibernate.Metamodel.entity.

Access to an entity supporting Hibernate's entity-name feature

Parameters
entityName:String

The entity-name

Returns:EntityTypeDescriptor<X>

The entity descriptor

Annotations
@Override
entityback to summary
public <X> EntityTypeDescriptor<X> entity(Class<X> cls)

Redeclares javax.persistence.metamodel.Metamodel.entity.

Doc from javax.persistence.metamodel.Metamodel.entity.

Return the metamodel entity type representing the entity.

Parameters
cls:Class<X>

the type of the represented entity

Returns:EntityTypeDescriptor<X>

the metamodel entity type

Annotations
@Override
entityPersisterback to summary
public EntityPersister entityPersister(Class<T> entityClass)

Locate the persister for an entity by the entity class.

Parameters
entityClass:Class<T>

The entity class

Returns:EntityPersister

The entity persister

Exceptions
MappingException:
Indicates persister for that class could not be found.
entityPersisterback to summary
public EntityPersister entityPersister(String entityName)

Locate the persister for an entity by the entity-name

Parameters
entityName:String

The name of the entity for which to retrieve the persister.

Returns:EntityPersister

The persister

Exceptions
MappingException:
Indicates persister could not be found with that name.
entityPersistersback to summary
public Map<String, EntityPersister> entityPersisters()

Get all entity persisters as a Map, which entity name its the key and the persister is the value.

Returns:Map<String, EntityPersister>

The Map contains all entity persisters.

findEntityGraphByNameback to summary
public <T> RootGraphImplementor<T> findEntityGraphByName(String name)
findEntityGraphsByJavaTypeback to summary
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass)
findEntityGraphsByTypeback to summary
public default <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass)

Deprecated

Use findEntityGraphsByJavaType(Class) instead.

Annotations
@Deprecated
getAllCollectionRolesback to summary
public String[] getAllCollectionRoles()

Get the names of all collections known to this Metamodel

Returns:String[]

All of the entity names

getAllEntityNamesback to summary
public String[] getAllEntityNames()

Get the names of all entities known to this Metamodel

Returns:String[]

All of the entity names

getCollectionRolesByEntityParticipantback to summary
public Set<String> getCollectionRolesByEntityParticipant(String entityName)

Retrieves a set of all the collection roles in which the given entity is a participant, as either an index or an element.

Parameters
entityName:String

The entity name for which to get the collection roles.

Returns:Set<String>

set of all the collection roles in which the given entityName participates.

getEntityNameResolversback to summary
public Collection<EntityNameResolver> getEntityNameResolvers()
getEntityTypeByNameback to summary
public default EntityTypeDescriptor<J> getEntityTypeByName(String entityName)

Overrides default org.hibernate.Metamodel.getEntityTypeByName.

Annotations
@Override
getSessionFactoryback to summary
public SessionFactoryImplementor getSessionFactory()

Redeclares org.hibernate.Metamodel.getSessionFactory.

Doc from org.hibernate.Metamodel.getSessionFactory.

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Access to the SessionFactory that this Metamodel instance is bound to.

Returns:SessionFactoryImplementor

The SessionFactory

Annotations
@Override
getTypeConfigurationback to summary
public TypeConfiguration getTypeConfiguration()

Access to the TypeConfiguration in effect for this SessionFactory/Metamodel

Returns:TypeConfiguration

Access to the TypeConfiguration

locateEntityPersisterback to summary
public EntityPersister locateEntityPersister(Class<T> byClass)

Locate an EntityPersister by the entity class. The passed Class might refer to either the entity name directly, or it might name a proxy interface for the entity. This method accounts for both, preferring the direct named entity name.

Parameters
byClass:Class<T>

The concrete Class or proxy interface for the entity to locate the persister for.

Returns:EntityPersister

The located EntityPersister, never null

Exceptions
UnknownEntityTypeException:
If a matching EntityPersister cannot be located
locateEntityPersisterback to summary
public EntityPersister locateEntityPersister(String byName)

Locate the entity persister by name.

Parameters
byName:String

The entity name

Returns:EntityPersister

The located EntityPersister, never null

Exceptions
UnknownEntityTypeException:
If a matching EntityPersister cannot be located
managedTypeback to summary
public <X> ManagedTypeDescriptor<X> managedType(Class<X> cls)

Redeclares javax.persistence.metamodel.Metamodel.managedType.

Doc from javax.persistence.metamodel.Metamodel.managedType.

Return the metamodel managed type representing the entity, mapped superclass, or embeddable class.

Parameters
cls:Class<X>

the type of the represented managed class

Returns:ManagedTypeDescriptor<X>

the metamodel managed type

Annotations
@Override