Package org.hibernate.cfg.annotations
Class CollectionBinder
- java.lang.Object
-
- org.hibernate.cfg.annotations.CollectionBinder
-
- Direct Known Subclasses:
BagBinder
,ListBinder
,MapBinder
,SetBinder
public abstract class CollectionBinder extends java.lang.Object
Base class for binding different types of collections to Hibernate configuration objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
cascadeDeleteEnabled
protected Collection
collection
protected IndexColumn
indexColumn
protected java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState>
inheritanceStatePerClass
protected java.util.HashMap<java.lang.String,IdentifierGeneratorDefinition>
localGenerators
protected java.lang.String
mapKeyPropertyName
protected java.lang.String
propertyName
-
Constructor Summary
Constructors Modifier Constructor Description protected
CollectionBinder(boolean isSortedCollection)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static java.lang.String
adjustUserSuppliedValueCollectionOrderingFragment(java.lang.String orderByFragment)
void
bind()
static void
bindManytoManyInverseFk(PersistentClass referencedEntity, Ejb3JoinColumn[] columns, SimpleValue value, boolean unique, MetadataBuildingContext buildingContext)
bind the inverse FK of a ManyToMany If we are in a mappedBy case, read the columns from the associated collection element Otherwise delegates to the usual algorithmprotected void
bindOneToManySecondPass(Collection collection, java.util.Map<java.lang.String,PersistentClass> persistentClasses, Ejb3JoinColumn[] fkJoinColumns, org.hibernate.annotations.common.reflection.XClass collectionType, boolean cascadeDeleteEnabled, NotFoundAction notFoundAction, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
protected boolean
bindStarToManySecondPass(java.util.Map<java.lang.String,PersistentClass> persistentClasses, org.hibernate.annotations.common.reflection.XClass collType, Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, org.hibernate.annotations.common.reflection.XProperty property, boolean unique, TableBinder associationTableBinder, NotFoundAction notFoundAction, MetadataBuildingContext buildingContext)
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(java.lang.String entityName, org.hibernate.annotations.common.reflection.XProperty property, boolean isIndexed, boolean isHibernateExtensionMapping, MetadataBuildingContext buildingContext)
collection binder factoryNotFoundAction
getNotFoundAction()
SecondPass
getSecondPass(Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, Ejb3Column[] mapKeyColumns, Ejb3JoinColumn[] mapKeyManyToManyColumns, boolean isEmbedded, org.hibernate.annotations.common.reflection.XProperty property, org.hibernate.annotations.common.reflection.XClass collType, NotFoundAction notFoundAction, boolean unique, TableBinder assocTableBinder, MetadataBuildingContext buildingContext)
protected boolean
isHibernateExtensionMapping()
boolean
isMap()
void
setAccessType(AccessType accessType)
void
setBatchSize(BatchSize batchSize)
void
setBuildingContext(MetadataBuildingContext buildingContext)
void
setCache(Cache cacheAnn)
void
setCascadeDeleteEnabled(boolean onDeleteCascade)
void
setCascadeStrategy(java.lang.String cascadeStrategy)
void
setCollectionType(org.hibernate.annotations.common.reflection.XClass collectionType)
void
setComparatorSort(SortComparator comparatorSort)
void
setDeclaringClass(org.hibernate.annotations.common.reflection.XClass declaringClass)
void
setElementColumns(Ejb3Column[] elementColumns)
void
setEmbedded(boolean annotationPresent)
void
setExplicitAssociationTable(boolean explicitAssocTable)
void
setFkJoinColumns(Ejb3JoinColumn[] ejb3JoinColumns)
void
setIgnoreNotFound(boolean ignoreNotFound)
void
setIndexColumn(IndexColumn indexColumn)
void
setInheritanceStatePerClass(java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
void
setInsertable(boolean insertable)
void
setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns)
protected void
setIsHibernateExtensionMapping(boolean hibernateExtensionMapping)
void
setJoinColumns(Ejb3JoinColumn[] joinColumns)
void
setJpaOrderBy(OrderBy jpaOrderBy)
void
setLocalGenerators(java.util.HashMap<java.lang.String,IdentifierGeneratorDefinition> localGenerators)
void
setMapKey(MapKey key)
void
setMapKeyColumns(Ejb3Column[] mapKeyColumns)
void
setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns)
void
setMappedBy(java.lang.String mappedBy)
void
setNaturalSort(SortNatural naturalSort)
void
setNotFoundAction(NotFoundAction notFoundAction)
void
setOneToMany(boolean oneToMany)
void
setProperty(org.hibernate.annotations.common.reflection.XProperty property)
void
setPropertyHolder(PropertyHolder propertyHolder)
void
setPropertyName(java.lang.String propertyName)
void
setSort(Sort deprecatedSort)
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 java.lang.String propertyName
-
indexColumn
protected IndexColumn indexColumn
-
cascadeDeleteEnabled
protected boolean cascadeDeleteEnabled
-
mapKeyPropertyName
protected java.lang.String mapKeyPropertyName
-
localGenerators
protected java.util.HashMap<java.lang.String,IdentifierGeneratorDefinition> localGenerators
-
inheritanceStatePerClass
protected java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass
-
-
Method Detail
-
getBuildingContext
protected MetadataBuildingContext getBuildingContext()
-
setBuildingContext
public void setBuildingContext(MetadataBuildingContext buildingContext)
-
isMap
public boolean isMap()
-
setIsHibernateExtensionMapping
protected void setIsHibernateExtensionMapping(boolean hibernateExtensionMapping)
-
isHibernateExtensionMapping
protected boolean isHibernateExtensionMapping()
-
setUpdatable
public void setUpdatable(boolean updatable)
-
setInheritanceStatePerClass
public void setInheritanceStatePerClass(java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
-
setInsertable
public void setInsertable(boolean insertable)
-
setCascadeStrategy
public void setCascadeStrategy(java.lang.String cascadeStrategy)
-
setAccessType
public void setAccessType(AccessType accessType)
-
setInverseJoinColumns
public void setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns)
-
setJoinColumns
public void setJoinColumns(Ejb3JoinColumn[] 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)
-
setSort
public void setSort(Sort deprecatedSort)
-
setNaturalSort
public void setNaturalSort(SortNatural naturalSort)
-
setComparatorSort
public void setComparatorSort(SortComparator comparatorSort)
-
getCollectionBinder
public static CollectionBinder getCollectionBinder(java.lang.String entityName, org.hibernate.annotations.common.reflection.XProperty property, boolean isIndexed, boolean isHibernateExtensionMapping, MetadataBuildingContext buildingContext)
collection binder factory
-
setMappedBy
public void setMappedBy(java.lang.String mappedBy)
-
setTableBinder
public void setTableBinder(TableBinder tableBinder)
-
setCollectionType
public void setCollectionType(org.hibernate.annotations.common.reflection.XClass collectionType)
-
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(java.lang.String propertyName)
-
setDeclaringClass
public void setDeclaringClass(org.hibernate.annotations.common.reflection.XClass declaringClass)
-
bind
public void bind()
-
getSecondPass
public SecondPass getSecondPass(Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, Ejb3Column[] mapKeyColumns, Ejb3JoinColumn[] mapKeyManyToManyColumns, boolean isEmbedded, org.hibernate.annotations.common.reflection.XProperty property, org.hibernate.annotations.common.reflection.XClass collType, NotFoundAction notFoundAction, boolean unique, TableBinder assocTableBinder, MetadataBuildingContext buildingContext)
-
bindStarToManySecondPass
protected boolean bindStarToManySecondPass(java.util.Map<java.lang.String,PersistentClass> persistentClasses, org.hibernate.annotations.common.reflection.XClass collType, Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, org.hibernate.annotations.common.reflection.XProperty property, boolean unique, TableBinder associationTableBinder, NotFoundAction notFoundAction, MetadataBuildingContext buildingContext)
return true if it's a Fk, false if it's an association table
-
bindOneToManySecondPass
protected void bindOneToManySecondPass(Collection collection, java.util.Map<java.lang.String,PersistentClass> persistentClasses, Ejb3JoinColumn[] fkJoinColumns, org.hibernate.annotations.common.reflection.XClass collectionType, boolean cascadeDeleteEnabled, NotFoundAction notFoundAction, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
-
setCache
public void setCache(Cache cacheAnn)
-
setOneToMany
public void setOneToMany(boolean oneToMany)
-
setIndexColumn
public void setIndexColumn(IndexColumn indexColumn)
-
setMapKey
public void setMapKey(MapKey key)
-
adjustUserSuppliedValueCollectionOrderingFragment
public static java.lang.String adjustUserSuppliedValueCollectionOrderingFragment(java.lang.String orderByFragment)
-
setCascadeDeleteEnabled
public void setCascadeDeleteEnabled(boolean onDeleteCascade)
-
bindManytoManyInverseFk
public static void bindManytoManyInverseFk(PersistentClass referencedEntity, Ejb3JoinColumn[] columns, SimpleValue value, boolean unique, MetadataBuildingContext buildingContext)
bind the inverse FK of a ManyToMany If we are in a mappedBy case, read the columns from the associated collection element Otherwise delegates to the usual algorithm
-
setFkJoinColumns
public void setFkJoinColumns(Ejb3JoinColumn[] ejb3JoinColumns)
-
setExplicitAssociationTable
public void setExplicitAssociationTable(boolean explicitAssocTable)
-
setElementColumns
public void setElementColumns(Ejb3Column[] 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)
-
setIgnoreNotFound
public void setIgnoreNotFound(boolean ignoreNotFound)
-
setMapKeyColumns
public void setMapKeyColumns(Ejb3Column[] mapKeyColumns)
-
setMapKeyManyToManyColumns
public void setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns)
-
setLocalGenerators
public void setLocalGenerators(java.util.HashMap<java.lang.String,IdentifierGeneratorDefinition> localGenerators)
-
-