| Method from org.hibernate.cfg.annotations.CollectionBinder Detail: |
public void bind() {
this.collection = createCollection( propertyHolder.getPersistentClass() );
log.debug( "Collection role: " + StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
collection.setRole( StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
collection.setNodeName( propertyName );
if ( property.isAnnotationPresent( org.hibernate.annotations.MapKey.class ) && mapKeyPropertyName != null ) {
throw new AnnotationException(
"Cannot mix @javax.persistence.MapKey and @org.hibernate.annotations.MapKey "
+ "on the same collection: " + StringHelper.qualify(
propertyHolder.getPath(), propertyName
)
);
}
//set laziness
defineFetchingStrategy();
//collection.setFetchMode( fetchMode );
//collection.setLazy( fetchMode == FetchMode.SELECT );
collection.setBatchSize( batchSize );
if ( orderBy != null && hqlOrderBy != null ) {
throw new AnnotationException(
"Cannot use sql order by clause in conjunction of EJB3 order by clause: " + safeCollectionRole()
);
}
collection.setMutable( ! property.isAnnotationPresent( Immutable.class ) );
OptimisticLock lockAnn = property.getAnnotation( OptimisticLock.class );
if (lockAnn != null) collection.setOptimisticLocked( ! lockAnn.excluded() );
Persister persisterAnn = property.getAnnotation( Persister.class );
if ( persisterAnn != null ) collection.setCollectionPersisterClass( persisterAnn.impl() );
// set ordering
if ( orderBy != null ) collection.setOrderBy( orderBy );
if ( isSorted ) {
collection.setSorted( true );
if ( comparator != null ) {
try {
collection.setComparator( (Comparator) comparator.newInstance() );
}
catch (ClassCastException e) {
throw new AnnotationException(
"Comparator not implementing java.util.Comparator class: "
+ comparator.getName() + "(" + safeCollectionRole() + ")"
);
}
catch (Exception e) {
throw new AnnotationException(
"Could not instantiate comparator class: "
+ comparator.getName() + "(" + safeCollectionRole() + ")"
);
}
}
}
else {
if ( hasToBeSorted ) {
throw new AnnotationException(
"A sorted collection has to define @Sort: "
+ safeCollectionRole()
);
}
}
//set cache
if ( StringHelper.isNotEmpty( cacheConcurrencyStrategy ) ) {
collection.setCacheConcurrencyStrategy( cacheConcurrencyStrategy );
collection.setCacheRegionName( cacheRegionName );
}
//SQL overriding
SQLInsert sqlInsert = property.getAnnotation( SQLInsert.class );
SQLUpdate sqlUpdate = property.getAnnotation( SQLUpdate.class );
SQLDelete sqlDelete = property.getAnnotation( SQLDelete.class );
SQLDeleteAll sqlDeleteAll = property.getAnnotation( SQLDeleteAll.class );
Loader loader = property.getAnnotation( Loader.class );
if ( sqlInsert != null ) {
collection.setCustomSQLInsert( sqlInsert.sql().trim(), sqlInsert.callable(),
ExecuteUpdateResultCheckStyle.parse( sqlInsert.check().toString().toLowerCase() )
);
}
if ( sqlUpdate != null ) {
collection.setCustomSQLUpdate( sqlUpdate.sql(), sqlUpdate.callable(),
ExecuteUpdateResultCheckStyle.parse( sqlUpdate.check().toString().toLowerCase() )
);
}
if ( sqlDelete != null ) {
collection.setCustomSQLDelete( sqlDelete.sql(), sqlDelete.callable(),
ExecuteUpdateResultCheckStyle.parse( sqlDelete.check().toString().toLowerCase() )
);
}
if ( sqlDeleteAll != null ) {
collection.setCustomSQLDeleteAll( sqlDeleteAll.sql(), sqlDeleteAll.callable(),
ExecuteUpdateResultCheckStyle.parse( sqlDeleteAll.check().toString().toLowerCase() )
);
}
if ( loader != null ) {
collection.setLoaderName( loader.namedQuery() );
}
//work on association
boolean isMappedBy = ! BinderHelper.isDefault( mappedBy );
collection.setInverse( isMappedBy );
//many to many may need some second pass informations
if ( ! oneToMany && isMappedBy ) {
mappings.addMappedBy( getCollectionType().getName(), mappedBy, propertyName );
}
//TODO reducce tableBinder != null and oneToMany
//FIXME collection of elements shouldn't be executed as a secondpass
SecondPass sp = getSecondPass(
fkJoinColumns,
joinColumns,
inverseJoinColumns,
elementColumns,
mapKeyColumns, mapKeyManyToManyColumns, isEmbedded,
property, getCollectionType(),
ignoreNotFound, oneToMany,
tableBinder, mappings
);
XClass collectionType = getCollectionType();
if ( collectionType.isAnnotationPresent( Embeddable.class )
|| property.isAnnotationPresent( CollectionOfElements.class ) ) {
// do it right away, otherwise @ManyToon on composite element call addSecondPass
// and raise a ConcurrentModificationException
//sp.doSecondPass( CollectionHelper.EMPTY_MAP );
mappings.addSecondPass( sp, ! isMappedBy );
}
else {
mappings.addSecondPass( sp, ! isMappedBy );
}
mappings.addCollection( collection );
//property building
PropertyBinder binder = new PropertyBinder();
binder.setName( propertyName );
binder.setValue( collection );
binder.setCascade( cascadeStrategy );
if ( cascadeStrategy != null && cascadeStrategy.indexOf( "delete-orphan" ) >= 0 ) {
collection.setOrphanDelete( true );
}
binder.setPropertyAccessorName( propertyAccessorName );
binder.setProperty( property );
binder.setInsertable( insertable );
binder.setUpdatable( updatable );
Property prop = binder.make();
//we don't care about the join stuffs because the column is on the association table.
propertyHolder.addProperty( prop );
}
|
protected void bindManyToManySecondPass(Collection collValue,
Map persistentClasses,
Ejb3JoinColumn[] joinColumns,
Ejb3JoinColumn[] inverseJoinColumns,
Ejb3Column[] elementColumns,
boolean isEmbedded,
XClass collType,
boolean ignoreNotFound,
boolean unique,
boolean cascadeDeleteEnabled,
TableBinder associationTableBinder,
XProperty property,
PropertyHolder parentPropertyHolder,
String hqlOrderBy,
ExtendedMappings mappings) throws MappingException {
PersistentClass collectionEntity = (PersistentClass) persistentClasses.get( collType.getName() );
boolean isCollectionOfEntities = collectionEntity != null;
if ( log.isDebugEnabled() ) {
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
if ( isCollectionOfEntities && unique ) {
log.debug( "Binding a OneToMany: " + path + " through an association table" );
}
else if ( isCollectionOfEntities ) {
log.debug( "Binding as ManyToMany: " + path );
}
else {
log.debug( "Binding a collection of element: " + path );
}
}
//check for user error
if ( ! isCollectionOfEntities ) {
if ( property.isAnnotationPresent( ManyToMany.class ) || property.isAnnotationPresent( OneToMany.class ) ) {
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
throw new AnnotationException(
"Use of @OneToMany or @ManyToMany targeting an unmapped class: " + path + "[" + collType + "]"
);
}
else {
JoinTable joinTableAnn = property.getAnnotation( JoinTable.class );
if ( joinTableAnn != null && joinTableAnn.inverseJoinColumns().length > 0 ) {
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
throw new AnnotationException(
"Use of @JoinTable.inverseJoinColumns targeting an unmapped class: " + path + "[" + collType + "]"
);
}
}
}
boolean mappedBy = ! BinderHelper.isDefault( joinColumns[0].getMappedBy() );
if ( mappedBy ) {
if ( ! isCollectionOfEntities ) {
StringBuilder error = new StringBuilder( 80 )
.append(
"Collection of elements must not have mappedBy or association reference an unmapped entity: "
)
.append( collValue.getOwnerEntityName() )
.append( "." )
.append( joinColumns[0].getPropertyName() );
throw new AnnotationException( error.toString() );
}
Property otherSideProperty;
try {
otherSideProperty = collectionEntity.getRecursiveProperty( joinColumns[0].getMappedBy() );
}
catch (MappingException e) {
StringBuilder error = new StringBuilder( 80 );
error.append( "mappedBy reference an unknown target entity property: " )
.append( collType ).append( "." ).append( joinColumns[0].getMappedBy() )
.append( " in " )
.append( collValue.getOwnerEntityName() )
.append( "." )
.append( joinColumns[0].getPropertyName() );
throw new AnnotationException( error.toString() );
}
Table table;
if ( otherSideProperty.getValue() instanceof Collection ) {
//this is a collection on the other side
table = ( (Collection) otherSideProperty.getValue() ).getCollectionTable();
}
else {
//This is a ToOne with a @JoinTable or a regular property
table = otherSideProperty.getValue().getTable();
}
collValue.setCollectionTable( table );
String entityName = collectionEntity.getEntityName();
for ( Ejb3JoinColumn column : joinColumns ) {
//column.setDefaultColumnHeader( joinColumns[0].getMappedBy() ); //seems not to be used, make sense
column.setManyToManyOwnerSideEntityName( entityName );
}
}
else {
//TODO: only for implicit columns?
//FIXME NamingStrategy
for ( Ejb3JoinColumn column : joinColumns ) {
String mappedByProperty = mappings.getFromMappedBy(
collValue.getOwnerEntityName(), column.getPropertyName()
);
Table ownerTable = collValue.getOwner().getTable();
column.setMappedBy(
collValue.getOwner().getEntityName(), mappings.getLogicalTableName( ownerTable ),
mappedByProperty
);
// String header = ( mappedByProperty == null ) ? mappings.getLogicalTableName( ownerTable ) : mappedByProperty;
// column.setDefaultColumnHeader( header );
}
if ( StringHelper.isEmpty( associationTableBinder.getName() ) ) {
//default value
associationTableBinder.setDefaultName(
collValue.getOwner().getEntityName(),
mappings.getLogicalTableName( collValue.getOwner().getTable() ),
collectionEntity != null ? collectionEntity.getEntityName() : null,
collectionEntity != null ? mappings.getLogicalTableName( collectionEntity.getTable() ) : null,
joinColumns[0].getPropertyName()
);
}
collValue.setCollectionTable( associationTableBinder.bind() );
}
bindFilters( isCollectionOfEntities );
bindCollectionSecondPass( collValue, collectionEntity, joinColumns, cascadeDeleteEnabled, property, mappings );
ManyToOne element = null;
if ( isCollectionOfEntities ) {
element =
new ManyToOne( collValue.getCollectionTable() );
collValue.setElement( element );
element.setReferencedEntityName( collType.getName() );
//element.setFetchMode( fetchMode );
//element.setLazy( fetchMode != FetchMode.JOIN );
//make the second join non lazy
element.setFetchMode( FetchMode.JOIN );
element.setLazy( false );
element.setIgnoreNotFound( ignoreNotFound );
if ( StringHelper.isNotEmpty( hqlOrderBy ) ) {
collValue.setManyToManyOrdering(
buildOrderByClauseFromHql( hqlOrderBy, collectionEntity, collValue.getRole() )
);
}
ForeignKey fk = property != null ? property.getAnnotation( ForeignKey.class ) : null;
String fkName = fk != null ? fk.inverseName() : "";
if ( ! BinderHelper.isDefault( fkName ) ) element.setForeignKeyName( fkName );
}
else {
XClass elementClass;
AnnotatedClassType classType;
// Map< String, javax.persistence.Column[] > columnOverrides = PropertyHolderBuilder.buildColumnOverride(
// property, StringHelper.qualify( collValue.getRole(), "element" )
// );
//FIXME the "element" is lost
PropertyHolder holder = null;
if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
classType = AnnotatedClassType.NONE;
elementClass = null;
}
else {
elementClass = collType;
classType = mappings.getClassType( elementClass );
holder = PropertyHolderBuilder.buildPropertyHolder(
collValue,
collValue.getRole(), // + ".element",
elementClass,
property, parentPropertyHolder, mappings
);
//force in case of attribute override
boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
|| property.isAnnotationPresent( AttributeOverrides.class );
if ( isEmbedded || attributeOverride ) {
classType = AnnotatedClassType.EMBEDDABLE;
}
}
if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
EntityBinder entityBinder = new EntityBinder();
PersistentClass owner = collValue.getOwner();
boolean isPropertyAnnotated;
//FIXME support @Access for collection of elements
//String accessType = access != null ? access.value() : null;
if ( owner.getIdentifierProperty() != null ) {
isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
}
else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
}
else {
throw new AssertionFailure( "Unable to guess collection property accessor name" );
}
//boolean propertyAccess = embeddable == null || AccessType.PROPERTY.equals( embeddable.access() );
PropertyData inferredData = new PropertyPreloadedData( "property", "element", elementClass );
//TODO be smart with isNullable
Component component = AnnotationBinder.fillComponent(
holder, inferredData, isPropertyAnnotated, isPropertyAnnotated ? "property" : "field", true,
entityBinder, false, false,
true, mappings
);
collValue.setElement( component );
if ( StringHelper.isNotEmpty( hqlOrderBy ) ) {
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
String orderBy = buildOrderByClauseFromHql( hqlOrderBy, component, path );
if ( orderBy != null ) {
collValue.setOrderBy( orderBy );
}
}
}
else {
SimpleValueBinder elementBinder = new SimpleValueBinder();
elementBinder.setMappings( mappings );
elementBinder.setReturnedClassName( collType.getName() );
if ( elementColumns == null || elementColumns.length == 0 ) {
elementColumns = new Ejb3Column[1];
Ejb3Column column = new Ejb3Column();
column.setImplicit( false );
//not following the spec but more clean
column.setNullable( true );
column.setLength( Ejb3Column.DEFAULT_COLUMN_LENGTH );
column.setLogicalColumnName( Collection.DEFAULT_ELEMENT_COLUMN_NAME );
//TODO create an EMPTY_JOINS collection
column.setJoins( new HashMap< String, Join >() );
column.setMappings( mappings );
column.bind();
elementColumns[0] = column;
}
//override the table
for ( Ejb3Column column : elementColumns ) {
column.setTable( collValue.getCollectionTable() );
}
elementBinder.setColumns( elementColumns );
elementBinder.setType( property, elementClass );
collValue.setElement( elementBinder.make() );
}
}
checkFilterConditions( collValue );
//FIXME: do optional = false
if ( isCollectionOfEntities ) {
bindManytoManyInverseFk( collectionEntity, inverseJoinColumns, element, unique, mappings );
}
}
|
public static void bindManytoManyInverseFk(PersistentClass referencedEntity,
Ejb3JoinColumn[] columns,
SimpleValue value,
boolean unique,
ExtendedMappings mappings) {
final String mappedBy = columns[0].getMappedBy();
if ( StringHelper.isNotEmpty( mappedBy ) ) {
final Property property = referencedEntity.getRecursiveProperty( mappedBy );
Iterator mappedByColumns;
if ( property.getValue() instanceof Collection ) {
mappedByColumns = ( (Collection) property.getValue() ).getKey().getColumnIterator();
}
else {
//find the appropriate reference key, can be in a join
Iterator joinsIt = referencedEntity.getJoinIterator();
KeyValue key = null;
while ( joinsIt.hasNext() ) {
Join join = (Join) joinsIt.next();
if ( join.containsProperty( property ) ) {
key = join.getKey();
break;
}
}
if ( key == null ) key = property.getPersistentClass().getIdentifier();
mappedByColumns = key.getColumnIterator();
}
while ( mappedByColumns.hasNext() ) {
Column column = (Column) mappedByColumns.next();
columns[0].linkValueUsingAColumnCopy( column, value );
}
String referencedPropertyName =
mappings.getPropertyReferencedAssociation(
"inverse__" + referencedEntity.getEntityName(), mappedBy
);
if ( referencedPropertyName != null ) {
//TODO always a many to one?
( (ManyToOne) value ).setReferencedPropertyName( referencedPropertyName );
mappings.addUniquePropertyReference( referencedEntity.getEntityName(), referencedPropertyName );
}
value.createForeignKey();
}
else {
BinderHelper.createSyntheticPropertyReference( columns, referencedEntity, null, value, true, mappings );
TableBinder.bindFk( referencedEntity, null, columns, value, unique, 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 bindOneToManySecondPass(Collection collection,
Map persistentClasses,
Ejb3JoinColumn[] fkJoinColumns,
XClass collectionType,
boolean cascadeDeleteEnabled,
boolean ignoreNotFound,
String hqlOrderBy,
ExtendedMappings extendedMappings) {
if ( log.isDebugEnabled() ) {
log.debug(
"Binding a OneToMany: " + propertyHolder.getEntityName() + "." + propertyName + " through a foreign key"
);
}
org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( collection.getOwner() );
collection.setElement( oneToMany );
oneToMany.setReferencedEntityName( collectionType.getName() );
oneToMany.setIgnoreNotFound( ignoreNotFound );
String assocClass = oneToMany.getReferencedEntityName();
PersistentClass associatedClass = (PersistentClass) persistentClasses.get( assocClass );
String orderBy = buildOrderByClauseFromHql( hqlOrderBy, associatedClass, collection.getRole() );
if ( orderBy != null ) collection.setOrderBy( orderBy );
if ( mappings == null ) {
throw new AssertionFailure(
"CollectionSecondPass for oneToMany should not be called with null mappings"
);
}
Map< String, Join > joins = mappings.getJoins( assocClass );
if ( associatedClass == null ) {
throw new MappingException(
"Association references unmapped class: " + assocClass
);
}
oneToMany.setAssociatedClass( associatedClass );
for ( Ejb3JoinColumn column : fkJoinColumns ) {
column.setPersistentClass( associatedClass, joins );
column.setJoins( joins );
collection.setCollectionTable( column.getTable() );
}
log.info(
"Mapping collection: " + collection.getRole() + " - > " + collection.getCollectionTable().getName()
);
bindFilters(false);
bindCollectionSecondPass( collection, null, fkJoinColumns, cascadeDeleteEnabled, property, mappings );
if ( !collection.isInverse()
&& !collection.getKey().isNullable() ) {
// for non-inverse one-to-many, with a not-null fk, add a backref!
String entityName = oneToMany.getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName );
Backref prop = new Backref();
prop.setName( '_" + fkJoinColumns[0].getPropertyName() + "Backref" );
prop.setUpdateable( false );
prop.setSelectable( false );
prop.setCollectionRole( collection.getRole() );
prop.setEntityName( collection.getOwner().getEntityName() );
prop.setValue( collection.getKey() );
referenced.addProperty( prop );
}
}
|
protected boolean bindStarToManySecondPass(Map persistentClasses,
XClass collType,
Ejb3JoinColumn[] fkJoinColumns,
Ejb3JoinColumn[] keyColumns,
Ejb3JoinColumn[] inverseColumns,
Ejb3Column[] elementColumns,
boolean isEmbedded,
XProperty property,
boolean unique,
TableBinder associationTableBinder,
boolean ignoreNotFound,
ExtendedMappings mappings) {
PersistentClass persistentClass = (PersistentClass) persistentClasses.get( collType.getName() );
boolean reversePropertyInJoin = false;
if ( persistentClass != null && StringHelper.isNotEmpty( this.mappedBy ) ) {
try {
reversePropertyInJoin = 0 != persistentClass.getJoinNumber(
persistentClass.getRecursiveProperty( this.mappedBy )
);
}
catch (MappingException e) {
StringBuilder error = new StringBuilder( 80 );
error.append( "mappedBy reference an unknown target entity property: " )
.append( collType ).append( "." ).append( this.mappedBy )
.append( " in " )
.append( collection.getOwnerEntityName() )
.append( "." )
.append( property.getName() );
throw new AnnotationException( error.toString() );
}
}
if ( persistentClass != null
&& ! reversePropertyInJoin
&& oneToMany
&& ! this.isExplicitAssociationTable
&& ( joinColumns[0].isImplicit() && ! BinderHelper.isDefault( this.mappedBy ) //implicit @JoinColumn
|| ! fkJoinColumns[0].isImplicit() ) //this is an explicit @JoinColumn
) {
//this is a Foreign key
bindOneToManySecondPass(
getCollection(),
persistentClasses,
fkJoinColumns,
collType,
cascadeDeleteEnabled,
ignoreNotFound, hqlOrderBy,
mappings
);
return true;
}
else {
//this is an association table
bindManyToManySecondPass(
this.collection,
persistentClasses,
keyColumns,
inverseColumns,
elementColumns,
isEmbedded, collType,
ignoreNotFound, unique,
cascadeDeleteEnabled,
associationTableBinder, property, propertyHolder, hqlOrderBy, mappings
);
return false;
}
}
return true if it's a Fk, false if it's an association table |
abstract protected Collection createCollection(PersistentClass persistentClass)
|
public Collection getCollection() {
return collection;
}
|
public static CollectionBinder getCollectionBinder(String entityName,
XProperty property,
boolean isIndexed) {
if ( property.isArray() ) {
if ( property.getElementClass().isPrimitive() ) {
return new PrimitiveArrayBinder();
}
else {
return new ArrayBinder();
}
}
else if ( property.isCollection() ) {
//TODO consider using an XClass
Class returnedClass = property.getCollectionClass();
if ( java.util.Set.class.equals( returnedClass ) ) {
return new SetBinder();
}
else if ( java.util.SortedSet.class.equals( returnedClass ) ) {
return new SetBinder( true );
}
else if ( java.util.Map.class.equals( returnedClass ) ) {
return new MapBinder();
}
else if ( java.util.SortedMap.class.equals( returnedClass ) ) {
return new MapBinder(true);
}
else if ( java.util.Collection.class.equals( returnedClass ) ) {
if ( property.isAnnotationPresent( CollectionId.class ) ) {
return new IdBagBinder();
}
else {
return new BagBinder();
}
}
else if ( java.util.List.class.equals( returnedClass ) ) {
if ( isIndexed ) {
return new ListBinder();
}
else if ( property.isAnnotationPresent( CollectionId.class ) ) {
return new IdBagBinder();
}
else {
return new BagBinder();
}
}
else {
throw new AnnotationException(
returnedClass.getName() + " collection not yet supported: "
+ StringHelper.qualify( entityName, property.getName() )
);
}
}
else {
throw new AnnotationException(
"Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: "
+ StringHelper.qualify( entityName, property.getName() )
);
}
}
collection binder factory |
public SecondPass getSecondPass(Ejb3JoinColumn[] fkJoinColumns,
Ejb3JoinColumn[] keyColumns,
Ejb3JoinColumn[] inverseColumns,
Ejb3Column[] elementColumns,
Ejb3Column[] mapKeyColumns,
Ejb3JoinColumn[] mapKeyManyToManyColumns,
boolean isEmbedded,
XProperty property,
XClass collType,
boolean ignoreNotFound,
boolean unique,
TableBinder assocTableBinder,
ExtendedMappings mappings) {
return new CollectionSecondPass( mappings, collection ) {
public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas)
throws MappingException {
bindStarToManySecondPass(
persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns,
isEmbedded, property, unique, assocTableBinder, ignoreNotFound, mappings
);
}
};
}
|
public void setBatchSize(BatchSize batchSize) {
this.batchSize = batchSize == null ? -1 : batchSize.size();
}
|
public void setCache(Cache cacheAnn) {
if ( cacheAnn != null ) {
cacheRegionName = BinderHelper.isDefault( cacheAnn.region() ) ? null : cacheAnn.region();
cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cacheAnn.usage() );
}
else {
cacheConcurrencyStrategy = null;
cacheRegionName = null;
}
}
|
public void setCascadeDeleteEnabled(boolean onDeleteCascade) {
this.cascadeDeleteEnabled = onDeleteCascade;
}
|
public void setCascadeStrategy(String cascadeStrategy) {
this.cascadeStrategy = cascadeStrategy;
}
|
public void setCollectionType(XClass collectionType) {
this.collectionType = collectionType;
}
|
public void setEjb3OrderBy(OrderBy orderByAnn) {
if ( orderByAnn != null ) {
hqlOrderBy = orderByAnn.value();
}
}
|
public void setElementColumns(Ejb3Column[] elementColumns) {
this.elementColumns = elementColumns;
}
|
public void setEmbedded(boolean annotationPresent) {
this.isEmbedded = annotationPresent;
}
|
public void setExplicitAssociationTable(boolean explicitAssocTable) {
this.isExplicitAssociationTable = explicitAssocTable;
}
|
public void setFkJoinColumns(Ejb3JoinColumn[] ejb3JoinColumns) {
this.fkJoinColumns = ejb3JoinColumns;
}
|
public void setIgnoreNotFound(boolean ignoreNotFound) {
this.ignoreNotFound = ignoreNotFound;
}
|
public void setIndexColumn(IndexColumn indexColumn) {
this.indexColumn = indexColumn;
}
|
public void setInsertable(boolean insertable) {
this.insertable = insertable;
}
|
public void setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns) {
this.inverseJoinColumns = inverseJoinColumns;
}
|
public void setJoinColumns(Ejb3JoinColumn[] joinColumns) {
this.joinColumns = joinColumns;
}
|
public void setLocalGenerators(HashMap localGenerators) {
this.localGenerators = localGenerators;
}
|
public void setMapKey(MapKey key) {
if ( key != null ) {
mapKeyPropertyName = key.name();
}
}
|
public void setMapKeyColumns(Ejb3Column[] mapKeyColumns) {
this.mapKeyColumns = mapKeyColumns;
}
|
public void setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns) {
this.mapKeyManyToManyColumns = mapJoinColumns;
}
|
public void setMappedBy(String mappedBy) {
this.mappedBy = mappedBy;
}
|
public void setMappings(ExtendedMappings mappings) {
this.mappings = mappings;
}
|
public void setOneToMany(boolean oneToMany) {
this.oneToMany = oneToMany;
}
|
public void setProperty(XProperty property) {
this.property = property;
}
|
public void setPropertyAccessorName(String propertyAccessorName) {
this.propertyAccessorName = propertyAccessorName;
}
|
public void setPropertyHolder(PropertyHolder propertyHolder) {
this.propertyHolder = propertyHolder;
}
|
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}
|
public void setSort(Sort sortAnn) {
if ( sortAnn != null ) {
isSorted = ! SortType.UNSORTED.equals( sortAnn.type() );
if ( isSorted && SortType.COMPARATOR.equals( sortAnn.type() ) ) {
comparator = sortAnn.comparator();
}
}
}
|
public void setSqlOrderBy(OrderBy orderByAnn) {
if ( orderByAnn != null ) {
if ( ! BinderHelper.isDefault( orderByAnn.clause() ) ) orderBy = orderByAnn.clause();
}
}
|
public void setTableBinder(TableBinder tableBinder) {
this.tableBinder = tableBinder;
}
|
public void setTargetEntity(XClass targetEntity) {
this.targetEntity = targetEntity;
}
|
public void setUpdatable(boolean updatable) {
this.updatable = updatable;
}
|