org.hibernate.cfg.annotations
Class CollectionBinder

java.lang.Object
  extended by org.hibernate.cfg.annotations.CollectionBinder
Direct Known Subclasses:
BagBinder, ListBinder, MapBinder, SetBinder

public abstract class CollectionBinder
extends Object

Base class for binding different types of collections to Hibernate configuration objects.

Author:
inger, Emmanuel Bernard

Field Summary
protected  boolean cascadeDeleteEnabled
           
protected  Collection collection
           
protected  String hqlOrderBy
           
protected  IndexColumn indexColumn
           
protected  Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass
           
protected  HashMap<String,IdGenerator> localGenerators
           
protected  String mapKeyPropertyName
           
protected  String propertyName
           
 
Constructor Summary
protected CollectionBinder()
           
protected CollectionBinder(boolean sorted)
           
 
Method Summary
 void bind()
           
static void bindManytoManyInverseFk(PersistentClass referencedEntity, Ejb3JoinColumn[] columns, SimpleValue value, boolean unique, ExtendedMappings mappings)
          bind the inverse FK of a ManyToMany If we are in a mappedBy case, read the columns from the associated colletion element Otherwise delegates to the usual algorithm
protected  void bindManyToManySecondPass(Collection collValue, Map persistentClasses, Ejb3JoinColumn[] joinColumns, Ejb3JoinColumn[] inverseJoinColumns, Ejb3Column[] elementColumns, boolean isEmbedded, org.hibernate.annotations.common.reflection.XClass collType, boolean ignoreNotFound, boolean unique, boolean cascadeDeleteEnabled, TableBinder associationTableBinder, org.hibernate.annotations.common.reflection.XProperty property, PropertyHolder parentPropertyHolder, String hqlOrderBy, ExtendedMappings mappings)
           
protected  void bindOneToManySecondPass(Collection collection, Map persistentClasses, Ejb3JoinColumn[] fkJoinColumns, org.hibernate.annotations.common.reflection.XClass collectionType, boolean cascadeDeleteEnabled, boolean ignoreNotFound, String hqlOrderBy, ExtendedMappings extendedMappings, Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
           
protected  boolean bindStarToManySecondPass(Map 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, boolean ignoreNotFound, ExtendedMappings mappings)
          return true if it's a Fk, false if it's an association table
protected abstract  Collection createCollection(PersistentClass persistentClass)
           
 Collection getCollection()
           
static CollectionBinder getCollectionBinder(String entityName, org.hibernate.annotations.common.reflection.XProperty property, boolean isIndexed, boolean isHibernateExtensionMapping)
          collection binder factory
 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, boolean ignoreNotFound, boolean unique, TableBinder assocTableBinder, ExtendedMappings mappings)
           
protected  boolean isHibernateExtensionMapping()
           
 boolean isMap()
           
 void setAccessType(AccessType accessType)
           
 void setBatchSize(BatchSize batchSize)
           
 void setCache(Cache cacheAnn)
           
 void setCascadeDeleteEnabled(boolean onDeleteCascade)
           
 void setCascadeStrategy(String cascadeStrategy)
           
 void setCollectionType(org.hibernate.annotations.common.reflection.XClass collectionType)
           
 void setDeclaringClass(org.hibernate.annotations.common.reflection.XClass declaringClass)
           
 void setEjb3OrderBy(OrderBy orderByAnn)
           
 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(Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
           
 void setInsertable(boolean insertable)
           
 void setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns)
           
 void setIsHibernateExtensionMapping(boolean hibernateExtensionMapping)
           
 void setJoinColumns(Ejb3JoinColumn[] joinColumns)
           
 void setLocalGenerators(HashMap<String,IdGenerator> localGenerators)
           
 void setMapKey(MapKey key)
           
 void setMapKeyColumns(Ejb3Column[] mapKeyColumns)
           
 void setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns)
           
 void setMappedBy(String mappedBy)
           
 void setMappings(ExtendedMappings mappings)
           
 void setOneToMany(boolean oneToMany)
           
 void setProperty(org.hibernate.annotations.common.reflection.XProperty property)
           
 void setPropertyHolder(PropertyHolder propertyHolder)
           
 void setPropertyName(String propertyName)
           
 void setSort(Sort sortAnn)
           
 void setSqlOrderBy(OrderBy orderByAnn)
           
 void setTableBinder(TableBinder tableBinder)
           
 void setTargetEntity(org.hibernate.annotations.common.reflection.XClass targetEntity)
           
 void setUpdatable(boolean updatable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collection

protected Collection collection

propertyName

protected String propertyName

indexColumn

protected IndexColumn indexColumn

hqlOrderBy

protected String hqlOrderBy

cascadeDeleteEnabled

protected boolean cascadeDeleteEnabled

mapKeyPropertyName

protected String mapKeyPropertyName

localGenerators

protected HashMap<String,IdGenerator> localGenerators

inheritanceStatePerClass

protected Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass
Constructor Detail

CollectionBinder

protected CollectionBinder()

CollectionBinder

protected CollectionBinder(boolean sorted)
Method Detail

isMap

public boolean isMap()

setIsHibernateExtensionMapping

public 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(Ejb3JoinColumn[] inverseJoinColumns)

setJoinColumns

public void setJoinColumns(Ejb3JoinColumn[] joinColumns)

setPropertyHolder

public void setPropertyHolder(PropertyHolder propertyHolder)

setBatchSize

public void setBatchSize(BatchSize batchSize)

setEjb3OrderBy

public void setEjb3OrderBy(OrderBy orderByAnn)

setSqlOrderBy

public void setSqlOrderBy(OrderBy orderByAnn)

setSort

public void setSort(Sort sortAnn)

getCollectionBinder

public static CollectionBinder getCollectionBinder(String entityName,
                                                   org.hibernate.annotations.common.reflection.XProperty property,
                                                   boolean isIndexed,
                                                   boolean isHibernateExtensionMapping)
collection binder factory


setMappedBy

public void setMappedBy(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)

setMappings

public void setMappings(ExtendedMappings mappings)

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()

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,
                                boolean ignoreNotFound,
                                boolean unique,
                                TableBinder assocTableBinder,
                                ExtendedMappings mappings)

bindStarToManySecondPass

protected boolean bindStarToManySecondPass(Map 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,
                                           boolean ignoreNotFound,
                                           ExtendedMappings mappings)
return true if it's a Fk, false if it's an association table


bindOneToManySecondPass

protected void bindOneToManySecondPass(Collection collection,
                                       Map persistentClasses,
                                       Ejb3JoinColumn[] fkJoinColumns,
                                       org.hibernate.annotations.common.reflection.XClass collectionType,
                                       boolean cascadeDeleteEnabled,
                                       boolean ignoreNotFound,
                                       String hqlOrderBy,
                                       ExtendedMappings extendedMappings,
                                       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)

bindManyToManySecondPass

protected void bindManyToManySecondPass(Collection collValue,
                                        Map persistentClasses,
                                        Ejb3JoinColumn[] joinColumns,
                                        Ejb3JoinColumn[] inverseJoinColumns,
                                        Ejb3Column[] elementColumns,
                                        boolean isEmbedded,
                                        org.hibernate.annotations.common.reflection.XClass collType,
                                        boolean ignoreNotFound,
                                        boolean unique,
                                        boolean cascadeDeleteEnabled,
                                        TableBinder associationTableBinder,
                                        org.hibernate.annotations.common.reflection.XProperty property,
                                        PropertyHolder parentPropertyHolder,
                                        String hqlOrderBy,
                                        ExtendedMappings mappings)
                                 throws MappingException
Throws:
MappingException

setCascadeDeleteEnabled

public void setCascadeDeleteEnabled(boolean onDeleteCascade)

bindManytoManyInverseFk

public static void bindManytoManyInverseFk(PersistentClass referencedEntity,
                                           Ejb3JoinColumn[] columns,
                                           SimpleValue value,
                                           boolean unique,
                                           ExtendedMappings mappings)
bind the inverse FK of a ManyToMany If we are in a mappedBy case, read the columns from the associated colletion 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)

setIgnoreNotFound

public void setIgnoreNotFound(boolean ignoreNotFound)

setMapKeyColumns

public void setMapKeyColumns(Ejb3Column[] mapKeyColumns)

setMapKeyManyToManyColumns

public void setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns)

setLocalGenerators

public void setLocalGenerators(HashMap<String,IdGenerator> localGenerators)


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.