entity.AssociationMapping.xpt Maven / Gradle / Ivy
«EXTENSION java::Naming»
«EXTENSION entity::ModelProperties»
«IMPORT uml»
«IMPORT JMM»
«IMPORT java»
// Association mapping
// This template maps association ends to the database
// Do nothing for everything except of Role
«DEFINE AssociationMapping FOR Element»«ENDDEFINE»
// The only type of assocations that can not be handled by the current implementation are directed m:n associations
// which do not make any sense. This is limitation is not caused by the template itself but by the eclipse uml model
// which does not allow navigation on directed associations in the not navigable direction.
//
// The template supports:
// - Directed one-to-one, many-to-one associations and one-to-many associations
// - Bidirectional one-to-many, many-to-many, many-to-one and one-to-one associations
«DEFINE AssociationMapping FOR Role»
«IF isNavigable()-»
«IF isComposite-»
«EXPAND CompositeMapping-»
«ELSE-»
«IF opposite == null -»
«IF isMultivalued() -»
«EXPAND UnidirectionalToMany -»
«ELSE-»
«EXPAND UnidirectionalToOne -»
«ENDIF -»
«ELSE -»
«IF isMultivalued() -»
«IF !opposite.isMultivalued() -»
«EXPAND BidirectionalOneToManyMapping -»
«ELSE-»
«EXPAND BidirectionalManyToManyMapping -»
«ENDIF-»
«ELSE-»
«IF opposite.isMultivalued() -»
«EXPAND BidirectionalManyToOne -»
«ELSE-»
«EXPAND BidirectionalOneToOneMapping -»
«ENDIF -»
«ENDIF -»
«ENDIF -»
«ENDIF -»
«ENDIF -»
«ENDDEFINE»
// Unidirectional one-to-one or many-to-one association
«DEFINE UnidirectionalToOne FOR Role -»
«ENDDEFINE»
// Unidirectional one-to-many association
«DEFINE UnidirectionalToMany FOR Role -»
0»batch-size="«batchSize»"«ENDIF» «IF fetchType.name != "none"»fetch="«fetchType.name»"«ENDIF»>
«ENDDEFINE»
// Bidirectional many-to-one association
«DEFINE BidirectionalManyToOne FOR Role -»
«ENDDEFINE»
// Bidirectional one-to-many association
«DEFINE BidirectionalOneToManyMapping FOR Role -»
0»batch-size="«batchSize»"«ENDIF» «IF fetchType.name != "none"»fetch="«fetchType.name»"«ENDIF»>
«ENDDEFINE»
// Bidirectional many-to-many association
«DEFINE BidirectionalManyToManyMapping FOR Role -»
0»inverse="true"«ENDIF» cascade="«cascade.getCascadeTypeNames()»" «IF batchSize > 0»batch-size="«batchSize»"«ENDIF»>
«ENDDEFINE»
// Bidirectional one-to-one association
«DEFINE BidirectionalOneToOneMapping FOR Role -»
«IF foreignKeyOwner -»
«ELSE-»
«ENDIF-»
«ENDDEFINE»
// Composite mapping
«DEFINE CompositeMapping FOR Role -»
«EXPAND PropertyMapping::PropertyMapping FOREACH type.attribute()»
«ENDDEFINE»