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

Collection binder

Author:
inger, emmanuel

Field Summary
protected  boolean cascadeDeleteEnabled
           
protected  org.hibernate.mapping.Collection collection
           
protected  String hqlOrderBy
           
protected  IndexColumn indexColumn
           
protected  String mapKeyPropertyName
           
protected  String propertyName
           
 
Constructor Summary
protected CollectionBinder()
           
protected CollectionBinder(boolean sorted)
           
 
Method Summary
 void addFilter(String name, String condition)
           
 void bind()
           
static void bindManytoManyInverseFk(org.hibernate.mapping.PersistentClass referencedEntity, Ejb3JoinColumn[] columns, org.hibernate.mapping.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 static void bindManyToManySecondPass(org.hibernate.mapping.Collection collValue, Map persistentClasses, Ejb3JoinColumn[] joinColumns, Ejb3JoinColumn[] inverseJoinColumns, Ejb3Column[] elementColumns, boolean isEmbedded, String collType, org.hibernate.FetchMode fetchMode, boolean ignoreNotFound, boolean unique, boolean cascadeDeleteEnabled, TableBinder associationTableBinder, XProperty property, ExtendedMappings mappings)
           
protected  void bindOneToManySecondPass(org.hibernate.mapping.Collection collection, Map persistentClasses, Ejb3JoinColumn[] fkJoinColumns, String collectionType, boolean cascadeDeleteEnabled, boolean ignoreNotFound, String hqlOrderBy, ExtendedMappings extendedMappings)
           
protected  boolean bindStarToManySecondPass(Map persistentClasses, String collType, Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, XProperty property, org.hibernate.FetchMode fetchMode, boolean unique, TableBinder associationTableBinder, boolean ignoreNotFound, ExtendedMappings mappings)
          return true if it's a Fk, false if it's an association table
protected abstract  org.hibernate.mapping.Collection createCollection(org.hibernate.mapping.PersistentClass persistentClass)
           
 org.hibernate.mapping.Collection getCollection()
           
static CollectionBinder getCollectionBinder(String entityName, PropertyData inferredData, boolean isIndexed)
          collection binder factory
 org.hibernate.cfg.SecondPass getSecondPass(Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, XProperty property, String collType, org.hibernate.FetchMode fetchMode, boolean ignoreNotFound, boolean unique, TableBinder assocTableBinder, ExtendedMappings mappings)
           
 void setBatchSize(BatchSize batchSize)
           
 void setCache(Cache cacheAnn)
           
 void setCascadeDeleteEnabled(boolean onDeleteCascade)
           
 void setCascadeStrategy(String cascadeStrategy)
           
 void setCollectionType(XClass collectionType)
           
 void setEjb3OrderBy(javax.persistence.OrderBy orderByAnn)
           
 void setElementColumns(Ejb3Column[] elementColumns)
           
 void setEmbedded(boolean annotationPresent)
           
 void setExplicitAssociationTable(boolean explicitAssocTable)
           
 void setFetchType(javax.persistence.FetchType fetch)
           
 void setFkJoinColumns(Ejb3JoinColumn[] ejb3JoinColumns)
           
 void setIgnoreNotFound(boolean ignoreNotFound)
           
 void setIndexColumn(IndexColumn indexColumn)
           
 void setInsertable(boolean insertable)
           
 void setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns)
           
 void setJoinColumns(Ejb3JoinColumn[] joinColumns)
           
 void setMapKey(javax.persistence.MapKey key)
           
 void setMappedBy(String mappedBy)
           
 void setMappings(ExtendedMappings mappings)
           
 void setOneToMany(boolean oneToMany)
           
 void setProperty(XProperty property)
           
 void setPropertyAccessorName(String propertyAccessorName)
           
 void setPropertyHolder(PropertyHolder propertyHolder)
           
 void setPropertyName(String propertyName)
           
 void setSort(Sort sortAnn)
           
 void setSqlOrderBy(OrderBy orderByAnn)
           
 void setTableBinder(TableBinder tableBinder)
           
 void setTargetEntity(XClass targetEntity)
           
 void setUpdatable(boolean updatable)
           
 void setWhere(Where whereAnn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collection

protected org.hibernate.mapping.Collection collection

propertyName

protected String propertyName

indexColumn

protected IndexColumn indexColumn

hqlOrderBy

protected String hqlOrderBy

cascadeDeleteEnabled

protected boolean cascadeDeleteEnabled

mapKeyPropertyName

protected String mapKeyPropertyName
Constructor Detail

CollectionBinder

protected CollectionBinder()

CollectionBinder

protected CollectionBinder(boolean sorted)
Method Detail

setUpdatable

public void setUpdatable(boolean updatable)

setInsertable

public void setInsertable(boolean insertable)

setCascadeStrategy

public void setCascadeStrategy(String cascadeStrategy)

setPropertyAccessorName

public void setPropertyAccessorName(String propertyAccessorName)

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(javax.persistence.OrderBy orderByAnn)

setSqlOrderBy

public void setSqlOrderBy(OrderBy orderByAnn)

setSort

public void setSort(Sort sortAnn)

getCollectionBinder

public static CollectionBinder getCollectionBinder(String entityName,
                                                   PropertyData inferredData,
                                                   boolean isIndexed)
collection binder factory


setMappedBy

public void setMappedBy(String mappedBy)

setTableBinder

public void setTableBinder(TableBinder tableBinder)

setCollectionType

public void setCollectionType(XClass collectionType)

setTargetEntity

public void setTargetEntity(XClass targetEntity)

setMappings

public void setMappings(ExtendedMappings mappings)

createCollection

protected abstract org.hibernate.mapping.Collection createCollection(org.hibernate.mapping.PersistentClass persistentClass)

getCollection

public org.hibernate.mapping.Collection getCollection()

setPropertyName

public void setPropertyName(String propertyName)

bind

public void bind()

getSecondPass

public org.hibernate.cfg.SecondPass getSecondPass(Ejb3JoinColumn[] fkJoinColumns,
                                                  Ejb3JoinColumn[] keyColumns,
                                                  Ejb3JoinColumn[] inverseColumns,
                                                  Ejb3Column[] elementColumns,
                                                  boolean isEmbedded,
                                                  XProperty property,
                                                  String collType,
                                                  org.hibernate.FetchMode fetchMode,
                                                  boolean ignoreNotFound,
                                                  boolean unique,
                                                  TableBinder assocTableBinder,
                                                  ExtendedMappings mappings)

bindStarToManySecondPass

protected boolean bindStarToManySecondPass(Map persistentClasses,
                                           String collType,
                                           Ejb3JoinColumn[] fkJoinColumns,
                                           Ejb3JoinColumn[] keyColumns,
                                           Ejb3JoinColumn[] inverseColumns,
                                           Ejb3Column[] elementColumns,
                                           boolean isEmbedded,
                                           XProperty property,
                                           org.hibernate.FetchMode fetchMode,
                                           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(org.hibernate.mapping.Collection collection,
                                       Map persistentClasses,
                                       Ejb3JoinColumn[] fkJoinColumns,
                                       String collectionType,
                                       boolean cascadeDeleteEnabled,
                                       boolean ignoreNotFound,
                                       String hqlOrderBy,
                                       ExtendedMappings extendedMappings)

setCache

public void setCache(Cache cacheAnn)

setFetchType

public void setFetchType(javax.persistence.FetchType fetch)

addFilter

public void addFilter(String name,
                      String condition)

setWhere

public void setWhere(Where whereAnn)

setOneToMany

public void setOneToMany(boolean oneToMany)

setIndexColumn

public void setIndexColumn(IndexColumn indexColumn)

setMapKey

public void setMapKey(javax.persistence.MapKey key)

bindManyToManySecondPass

protected static void bindManyToManySecondPass(org.hibernate.mapping.Collection collValue,
                                               Map persistentClasses,
                                               Ejb3JoinColumn[] joinColumns,
                                               Ejb3JoinColumn[] inverseJoinColumns,
                                               Ejb3Column[] elementColumns,
                                               boolean isEmbedded,
                                               String collType,
                                               org.hibernate.FetchMode fetchMode,
                                               boolean ignoreNotFound,
                                               boolean unique,
                                               boolean cascadeDeleteEnabled,
                                               TableBinder associationTableBinder,
                                               XProperty property,
                                               ExtendedMappings mappings)
                                        throws org.hibernate.MappingException
Throws:
org.hibernate.MappingException

setCascadeDeleteEnabled

public void setCascadeDeleteEnabled(boolean onDeleteCascade)

bindManytoManyInverseFk

public static void bindManytoManyInverseFk(org.hibernate.mapping.PersistentClass referencedEntity,
                                           Ejb3JoinColumn[] columns,
                                           org.hibernate.mapping.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(XProperty property)

setIgnoreNotFound

public void setIgnoreNotFound(boolean ignoreNotFound)