Class JpaMetamodelEntityInformation<T,ID>
java.lang.Object
org.springframework.data.repository.core.support.AbstractEntityInformation<T,ID>
org.springframework.data.jpa.repository.support.JpaEntityInformationSupport<T,ID>
org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation<T,ID>
- All Implemented Interfaces:
JpaEntityMetadata<T>
,JpaEntityInformation<T,
,ID> EntityInformation<T,
,ID> EntityMetadata<T>
- Direct Known Subclasses:
JpaPersistableEntityInformation
Implementation of
EntityInformation
that uses JPA Metamodel
to find the domain class' id field.- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Mark Paluch, Jens Schauder, Greg Turnquist
-
Constructor Summary
ConstructorDescriptionJpaMetamodelEntityInformation
(Class<T> domainClass, jakarta.persistence.metamodel.Metamodel metamodel, jakarta.persistence.PersistenceUnitUtil persistenceUnitUtil) Creates a newJpaMetamodelEntityInformation
for the given domain class andMetamodel
. -
Method Summary
Modifier and TypeMethodDescriptiongetCompositeIdAttributeValue
(Object id, String idAttribute) Extracts the value for the given id attribute from a composite idReturns the name of the entity.jakarta.persistence.metamodel.SingularAttribute<? super T,
?> Returns the id attribute of the entity.Returns the attribute names of the id attributes.Extract a keyset forpropertyPaths
and the primary key (including composite key components if applicable).boolean
Returns true if the entity has a composite id.boolean
Methods inherited from class org.springframework.data.jpa.repository.support.JpaEntityInformationSupport
getEntityInformation
Methods inherited from class org.springframework.data.repository.core.support.AbstractEntityInformation
getJavaType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.repository.core.EntityInformation
getRequiredId
Methods inherited from interface org.springframework.data.repository.core.EntityMetadata
getJavaType
Methods inherited from interface org.springframework.data.jpa.repository.support.JpaEntityInformation
getRequiredIdAttribute
-
Constructor Details
-
JpaMetamodelEntityInformation
public JpaMetamodelEntityInformation(Class<T> domainClass, jakarta.persistence.metamodel.Metamodel metamodel, jakarta.persistence.PersistenceUnitUtil persistenceUnitUtil) Creates a newJpaMetamodelEntityInformation
for the given domain class andMetamodel
.- Parameters:
domainClass
- must not be null.metamodel
- must not be null.persistenceUnitUtil
- must not be null.
-
-
Method Details
-
getEntityName
Description copied from interface:JpaEntityMetadata
Returns the name of the entity.- Specified by:
getEntityName
in interfaceJpaEntityMetadata<T>
- Overrides:
getEntityName
in classJpaEntityInformationSupport<T,
ID> - Returns:
-
getId
-
getIdType
-
getIdAttribute
Description copied from interface:JpaEntityInformation
Returns the id attribute of the entity. -
hasCompositeId
public boolean hasCompositeId()Description copied from interface:JpaEntityInformation
Returns true if the entity has a composite id. -
getIdAttributeNames
Description copied from interface:JpaEntityInformation
Returns the attribute names of the id attributes. If the entity has a composite id, then all id attribute names are returned. If the entity has a single id attribute then this single attribute name is returned. -
getCompositeIdAttributeValue
Description copied from interface:JpaEntityInformation
Extracts the value for the given id attribute from a composite id- Parameters:
id
- the composite id from which to extract the attribute.idAttribute
- the attribute name to extract.
-
isNew
- Specified by:
isNew
in interfaceEntityInformation<T,
ID> - Overrides:
isNew
in classAbstractEntityInformation<T,
ID>
-
getKeyset
Description copied from interface:JpaEntityInformation
Extract a keyset forpropertyPaths
and the primary key (including composite key components if applicable).- Parameters:
propertyPaths
- the property paths that make up the keyset in combination with the composite key components.entity
- the entity to extract values from- Returns:
- a map mapping String representations of the paths to values from the entity.
-