Class CollectionBinder
- java.lang.Object
-
- org.hibernate.boot.model.internal.CollectionBinder
-
- Direct Known Subclasses:
BagBinder
,ListBinder
,MapBinder
,SetBinder
public abstract class CollectionBinder extends Object
Base class for stateful binders responsible for producing mapping model objects of typeCollection
.
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection
collection
protected AnnotatedJoinColumns
foreignJoinColumns
protected boolean
hasMapKeyProperty
protected IndexColumn
indexColumn
protected Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState>
inheritanceStatePerClass
protected AnnotatedJoinColumns
inverseJoinColumns
protected boolean
isEmbedded
protected Map<String,IdentifierGeneratorDefinition>
localGenerators
protected AnnotatedColumns
mapKeyColumns
protected AnnotatedJoinColumns
mapKeyManyToManyColumns
protected String
mapKeyPropertyName
protected NotFoundAction
notFoundAction
protected OnDeleteAction
onDeleteAction
protected org.hibernate.annotations.common.reflection.XProperty
property
protected PropertyHolder
propertyHolder
protected String
propertyName
-
Constructor Summary
Constructors Modifier Constructor Description protected
CollectionBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, boolean isSortedCollection, MetadataBuildingContext buildingContext)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static String
adjustUserSuppliedValueCollectionOrderingFragment(String orderByFragment)
void
bind()
static void
bindCollection(PropertyHolder propertyHolder, Nullability nullability, PropertyData inferredData, Map<String,IdentifierGeneratorDefinition> classGenerators, EntityBinder entityBinder, boolean isIdentifierMapper, MetadataBuildingContext context, Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass, org.hibernate.annotations.common.reflection.XProperty property, AnnotatedJoinColumns joinColumns)
The first pass at binding a collection.void
bindManyToManyInverseForeignKey(PersistentClass targetEntity, AnnotatedJoinColumns joinColumns, SimpleValue value, boolean unique)
Bind the inverse foreign key of aManyToMany
, that is, the columns specified by@JoinTable(inverseJoinColumns=...)
, which are the columns that reference the target entity of the many-to-many association.protected void
bindOneToManySecondPass(Map<String,PersistentClass> persistentClasses)
Bind aOneToMany
association.protected boolean
bindStarToManySecondPass(Map<String,PersistentClass> persistentClasses)
return true if it's a Fk, false if it's an association tableprotected abstract Collection
createCollection(PersistentClass persistentClass)
protected MetadataBuildingContext
getBuildingContext()
Collection
getCollection()
static CollectionBinder
getCollectionBinder(org.hibernate.annotations.common.reflection.XProperty property, boolean isHibernateExtensionMapping, MetadataBuildingContext buildingContext)
collection binder factorySupplier<ManagedBean<? extends UserCollectionType>>
getCustomTypeBeanResolver()
NotFoundAction
getNotFoundAction()
protected boolean
isHibernateExtensionMapping()
boolean
isMap()
static ManagedBean<? extends UserCollectionType>
resolveCustomType(org.hibernate.annotations.common.reflection.XProperty property, CollectionType typeAnnotation, MetadataBuildingContext context)
void
setAccessType(AccessType accessType)
void
setBatchSize(BatchSize batchSize)
void
setCache(Cache cache)
void
setCascadeStrategy(String cascadeStrategy)
void
setComparatorSort(SortComparator comparatorSort)
void
setDeclaringClass(org.hibernate.annotations.common.reflection.XClass declaringClass)
void
setElementColumns(AnnotatedColumns elementColumns)
void
setElementType(org.hibernate.annotations.common.reflection.XClass collectionElementType)
void
setEmbedded(boolean annotationPresent)
void
setExplicitAssociationTable(boolean isExplicitAssociationTable)
void
setFkJoinColumns(AnnotatedJoinColumns annotatedJoinColumns)
void
setIndexColumn(IndexColumn indexColumn)
void
setInheritanceStatePerClass(Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
void
setInsertable(boolean insertable)
void
setInverseJoinColumns(AnnotatedJoinColumns inverseJoinColumns)
protected void
setIsHibernateExtensionMapping(boolean hibernateExtensionMapping)
void
setJoinColumns(AnnotatedJoinColumns joinColumns)
void
setJpaOrderBy(OrderBy jpaOrderBy)
void
setLocalGenerators(Map<String,IdentifierGeneratorDefinition> localGenerators)
void
setMapKey(MapKey key)
void
setMapKeyColumns(AnnotatedColumns mapKeyColumns)
void
setMapKeyManyToManyColumns(AnnotatedJoinColumns mapJoinColumns)
void
setMappedBy(String mappedBy)
void
setNaturalSort(SortNatural naturalSort)
void
setNotFoundAction(NotFoundAction notFoundAction)
void
setOnDeleteActionAction(OnDeleteAction onDeleteAction)
void
setOneToMany(boolean oneToMany)
void
setProperty(org.hibernate.annotations.common.reflection.XProperty property)
void
setPropertyHolder(PropertyHolder propertyHolder)
void
setPropertyName(String propertyName)
void
setSqlOrderBy(OrderBy sqlOrderBy)
void
setTableBinder(TableBinder tableBinder)
void
setTargetEntity(org.hibernate.annotations.common.reflection.XClass targetEntity)
void
setUpdatable(boolean updatable)
-
-
-
Field Detail
-
collection
protected Collection collection
-
propertyName
protected String propertyName
-
propertyHolder
protected PropertyHolder propertyHolder
-
indexColumn
protected IndexColumn indexColumn
-
onDeleteAction
protected OnDeleteAction onDeleteAction
-
hasMapKeyProperty
protected boolean hasMapKeyProperty
-
mapKeyPropertyName
protected String mapKeyPropertyName
-
inverseJoinColumns
protected AnnotatedJoinColumns inverseJoinColumns
-
foreignJoinColumns
protected AnnotatedJoinColumns foreignJoinColumns
-
isEmbedded
protected boolean isEmbedded
-
property
protected org.hibernate.annotations.common.reflection.XProperty property
-
notFoundAction
protected NotFoundAction notFoundAction
-
mapKeyColumns
protected AnnotatedColumns mapKeyColumns
-
mapKeyManyToManyColumns
protected AnnotatedJoinColumns mapKeyManyToManyColumns
-
localGenerators
protected Map<String,IdentifierGeneratorDefinition> localGenerators
-
inheritanceStatePerClass
protected Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass
-
-
Constructor Detail
-
CollectionBinder
protected CollectionBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, boolean isSortedCollection, MetadataBuildingContext buildingContext)
-
-
Method Detail
-
bindCollection
public static void bindCollection(PropertyHolder propertyHolder, Nullability nullability, PropertyData inferredData, Map<String,IdentifierGeneratorDefinition> classGenerators, EntityBinder entityBinder, boolean isIdentifierMapper, MetadataBuildingContext context, Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass, org.hibernate.annotations.common.reflection.XProperty property, AnnotatedJoinColumns joinColumns)
The first pass at binding a collection.
-
getBuildingContext
protected MetadataBuildingContext getBuildingContext()
-
getCustomTypeBeanResolver
public Supplier<ManagedBean<? extends UserCollectionType>> getCustomTypeBeanResolver()
-
isMap
public boolean isMap()
-
setIsHibernateExtensionMapping
protected void setIsHibernateExtensionMapping(boolean hibernateExtensionMapping)
-
isHibernateExtensionMapping
protected boolean isHibernateExtensionMapping()
-
setUpdatable
public void setUpdatable(boolean updatable)
-
setInheritanceStatePerClass
public void setInheritanceStatePerClass(Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
-
setInsertable
public void setInsertable(boolean insertable)
-
setCascadeStrategy
public void setCascadeStrategy(String cascadeStrategy)
-
setAccessType
public void setAccessType(AccessType accessType)
-
setInverseJoinColumns
public void setInverseJoinColumns(AnnotatedJoinColumns inverseJoinColumns)
-
setJoinColumns
public void setJoinColumns(AnnotatedJoinColumns joinColumns)
-
setPropertyHolder
public void setPropertyHolder(PropertyHolder propertyHolder)
-
setBatchSize
public void setBatchSize(BatchSize batchSize)
-
setJpaOrderBy
public void setJpaOrderBy(OrderBy jpaOrderBy)
-
setSqlOrderBy
public void setSqlOrderBy(OrderBy sqlOrderBy)
-
setNaturalSort
public void setNaturalSort(SortNatural naturalSort)
-
setComparatorSort
public void setComparatorSort(SortComparator comparatorSort)
-
getCollectionBinder
public static CollectionBinder getCollectionBinder(org.hibernate.annotations.common.reflection.XProperty property, boolean isHibernateExtensionMapping, MetadataBuildingContext buildingContext)
collection binder factory
-
resolveCustomType
public static ManagedBean<? extends UserCollectionType> resolveCustomType(org.hibernate.annotations.common.reflection.XProperty property, CollectionType typeAnnotation, MetadataBuildingContext context)
-
setMappedBy
public void setMappedBy(String mappedBy)
-
setTableBinder
public void setTableBinder(TableBinder tableBinder)
-
setElementType
public void setElementType(org.hibernate.annotations.common.reflection.XClass collectionElementType)
-
setTargetEntity
public void setTargetEntity(org.hibernate.annotations.common.reflection.XClass targetEntity)
-
createCollection
protected abstract Collection createCollection(PersistentClass persistentClass)
-
getCollection
public Collection getCollection()
-
setPropertyName
public void setPropertyName(String propertyName)
-
setDeclaringClass
public void setDeclaringClass(org.hibernate.annotations.common.reflection.XClass declaringClass)
-
bind
public void bind()
-
bindStarToManySecondPass
protected boolean bindStarToManySecondPass(Map<String,PersistentClass> persistentClasses)
return true if it's a Fk, false if it's an association table
-
bindOneToManySecondPass
protected void bindOneToManySecondPass(Map<String,PersistentClass> persistentClasses)
Bind aOneToMany
association.
-
setCache
public void setCache(Cache cache)
-
setOneToMany
public void setOneToMany(boolean oneToMany)
-
setIndexColumn
public void setIndexColumn(IndexColumn indexColumn)
-
setMapKey
public void setMapKey(MapKey key)
-
adjustUserSuppliedValueCollectionOrderingFragment
public static String adjustUserSuppliedValueCollectionOrderingFragment(String orderByFragment)
-
setOnDeleteActionAction
public void setOnDeleteActionAction(OnDeleteAction onDeleteAction)
-
bindManyToManyInverseForeignKey
public void bindManyToManyInverseForeignKey(PersistentClass targetEntity, AnnotatedJoinColumns joinColumns, SimpleValue value, boolean unique)
Bind the inverse foreign key of aManyToMany
, that is, the columns specified by@JoinTable(inverseJoinColumns=...)
, which are the columns that reference the target entity of the many-to-many association. If we are in amappedBy
case, read the columns from the associated collection element in the target entity.
-
setFkJoinColumns
public void setFkJoinColumns(AnnotatedJoinColumns annotatedJoinColumns)
-
setExplicitAssociationTable
public void setExplicitAssociationTable(boolean isExplicitAssociationTable)
-
setElementColumns
public void setElementColumns(AnnotatedColumns elementColumns)
-
setEmbedded
public void setEmbedded(boolean annotationPresent)
-
setProperty
public void setProperty(org.hibernate.annotations.common.reflection.XProperty property)
-
getNotFoundAction
public NotFoundAction getNotFoundAction()
-
setNotFoundAction
public void setNotFoundAction(NotFoundAction notFoundAction)
-
setMapKeyColumns
public void setMapKeyColumns(AnnotatedColumns mapKeyColumns)
-
setMapKeyManyToManyColumns
public void setMapKeyManyToManyColumns(AnnotatedJoinColumns mapJoinColumns)
-
setLocalGenerators
public void setLocalGenerators(Map<String,IdentifierGeneratorDefinition> localGenerators)
-
-