From: Vance K. <va...@us...> - 2006-05-29 01:37:59
|
User: vancek Date: 06/05/28 18:37:57 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3AssociationEndFacadeLogicImpl.java andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fixed EJB-25 - Many-To-Many JoinTable issue for name property of JoinColum annotation - set name property to foreign key constraint name. Revision Changes Path 1.9 +68 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java Index: EJB3AssociationEndFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- EJB3AssociationEndFacadeLogicImpl.java 14 Mar 2006 06:22:21 -0000 1.8 +++ EJB3AssociationEndFacadeLogicImpl.java 29 May 2006 01:37:57 -0000 1.9 @@ -9,6 +9,8 @@ import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.cartridges.ejb3.EJB3Profile; import org.andromda.metafacades.uml.ClassifierFacade; +import org.andromda.metafacades.uml.Entity; +import org.andromda.metafacades.uml.EntityMetafacadeUtils; import org.andromda.metafacades.uml.TaggedValueFacade; import org.andromda.metafacades.uml.TypeMappings; import org.andromda.metafacades.uml.UMLMetafacadeProperties; @@ -650,4 +652,70 @@ { return BooleanUtils.toBoolean(String.valueOf(this.getConfiguredProperty(HIBERNATE_ASSOCIATION_ENABLE_CACHE))); } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic# + * handleGetForeignKeyConstraintName(java.lang.String) + */ + protected String handleGetForeignKeyConstraintName(String suffix) + { + String constraintName; + + final Object taggedValueObject = findTaggedValue( + UMLProfile.TAGGEDVALUE_PERSISTENCE_FOREIGN_KEY_CONSTRAINT_NAME); + + /** + * Construct our own foreign key constraint name here + */ + StringBuffer buffer = new StringBuffer(); + + if (taggedValueObject == null) + { + final ClassifierFacade type = getOtherEnd().getType(); + if (type instanceof Entity) + { + Entity entity = (Entity)type; + buffer.append(entity.getTableName()); + } + else + { + // should not happen + buffer.append(type.getName().toUpperCase()); + } + } + else + { + // use the tagged value + buffer.append(taggedValueObject.toString()); + } + + buffer.append(this.getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR)); + + /** + * Add the suffix - which is the name of the identifier pk column if not blank + * otherwise use the column name of the relationship + */ + if (StringUtils.isNotBlank(suffix)) + { + buffer.append(suffix); + } + else + { + buffer.append(this.getColumnName()); + } + constraintName = buffer.toString(); + + final String constraintSuffix = + ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.CONSTRAINT_SUFFIX)).trim(); + + /** + * we take into consideration the maximum length allowed + */ + final String maxLengthString = (String)getConfiguredProperty(UMLMetafacadeProperties.MAX_SQL_NAME_LENGTH); + final short maxLength = (short)(Short.valueOf(maxLengthString).shortValue() - constraintSuffix.length()); + buffer = new StringBuffer( + EntityMetafacadeUtils.ensureMaximumNameLength(constraintName, new Short(maxLength))); + buffer.append(constraintSuffix); + return buffer.toString(); + } } \ No newline at end of file 1.29 +2 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -r1.28 -r1.29 --- EntityEmbeddable.vsl 15 May 2006 12:42:07 -0000 1.28 +++ EntityEmbeddable.vsl 29 May 2006 01:37:57 -0000 1.29 @@ -642,8 +642,8 @@ @javax.persistence.JoinTable ( name = "${associationEnd.association.tableName}", - joinColumns = {#set ($identifiers = $entity.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#}, - inverseJoinColumns = {#set ($identifiers = $target.type.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#} + joinColumns = {#set ($identifiers = $entity.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$target.getForeignKeyConstraintName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#}, + inverseJoinColumns = {#set ($identifiers = $target.type.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyConstraintName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#} ) #* *##end #* *##end |
From: Vance K. <va...@us...> - 2006-06-17 03:51:05
|
User: vancek Date: 06/06/16 20:51:02 Modified: andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: DiscriminatorValue annotation should not be rendered on subclasses where the super entity is an mapped superclass Revision Changes Path 1.7 +5 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- changes.xml 14 Jun 2006 14:37:25 -0000 1.6 +++ changes.xml 17 Jun 2006 03:51:02 -0000 1.7 @@ -100,6 +100,11 @@ <action dev="vancek" due-to="tlu" type="update"> Generate documentation for enumeration literals. </action> + <action dev="vancek" type="fix"> + Inheritance hierarchies where the super class is a mapped superclass, the subclass should not + render the DiscriminatorValue annotation. This annotation should only be rendered in subclasses of + single table inheritance hierarchies. + </action> </release> </body> </document> \ No newline at end of file 1.32 +1 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.31 retrieving revision 1.32 diff -u -w -r1.31 -r1.32 --- EntityEmbeddable.vsl 14 Jun 2006 04:55:20 -0000 1.31 +++ EntityEmbeddable.vsl 17 Jun 2006 03:51:02 -0000 1.32 @@ -75,7 +75,7 @@ @javax.persistence.DiscriminatorColumn(#if ($entity.discriminatorColumn)name = "${entity.discriminatorColumn}"#set ($argExists = true)#end#if ($entity.discriminatorType)#if ($argExists), #end#**#discriminatorType = javax.persistence.DiscriminatorType.${entity.discriminatorType}#set ($argExists = true)#end#if ($entity.discriminatorColumnDefinition)#if ($argExists), #end#**#columnDefinition = "${entity.discriminatorColumnDefinition}"#set ($argExists = true)#end#if ($entity.discriminatorLength > 0)#if ($argExists), #end#**#length = ${entity.discriminatorLength}#end) @javax.persistence.DiscriminatorValue("${entity.discriminatorValue}") #* *##end -#**##elseif ($entity.requiresGeneralizationMapping && $entity.inheritanceSingleTable) +#**##elseif ($entity.requiresGeneralizationMapping && $entity.inheritanceSingleTable && !$entity.embeddableSuperclassGeneralizationExists) ## ## Only include the DiscriminatorValue annotation for subclasses if ## the inheritance strategy is single table mapping strategy. |
From: Vance K. <va...@us...> - 2006-06-26 06:37:14
|
User: vancek Date: 06/06/25 23:37:13 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: moved @Version annotation from getter to attribute - all other annotation of the getter of a version attribute are disabled render the @Table annotation for every suitable entity - not just those with inheritence Revision Changes Path 1.33 +14 -5 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.32 retrieving revision 1.33 diff -u -w -r1.32 -r1.33 --- EntityEmbeddable.vsl 17 Jun 2006 03:51:02 -0000 1.32 +++ EntityEmbeddable.vsl 26 Jun 2006 06:37:12 -0000 1.33 @@ -55,7 +55,7 @@ ## If a class is manually specified as an embeddable superclass, add ## the Table annotation to the subclass, not to the base superclass. ## -#**##if (!$entity.entityImplementationRequired && ($entity.requiresSpecializationMapping || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) +#**##if (!$entity.entityImplementationRequired && ($entity.requiresSpecializationMapping || !$entity.requiresGeneralizationMapping || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) @javax.persistence.Table(name = "${entity.tableName}") #**##end #**##if ($entity.listenerEnabled) @@ -169,6 +169,12 @@ #* *##set ($doAttribute = true) #* *##end #* *##if ($doAttribute) +#* *##if (!$attribute.transient && $attribute.version) +## +## Add the Version annotation on the attribute itself +## + @javax.persistence.Version +#* *##end ## ## Check for overriding LOB type ## @@ -382,7 +388,7 @@ ## #* *##if ($attribute.transient) @javax.persistence.Transient -#* *##else +#* *##elseif (!$attribute.version) #* *##if ($attribute.identifier) @javax.persistence.Id #* *##if ($attribute.sequenceGeneratorType) @@ -394,9 +400,6 @@ @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.${attribute.generatorType}#if ($attribute.sequenceGeneratorType || $attribute.tableGeneratorType), generator = "${attribute.generatorName}"#end) #* *##end #* *##end -#* *##if ($attribute.version) - @javax.persistence.Version -#* *##end #* *##if ($attribute.lob) ## ## Add if LOB type is specified - do not set LOB type as of PFD Spec - inferred from type. @@ -559,6 +562,9 @@ #* *##if ($target.associationCacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${target.cacheType}) #* *##end +#* *##if ($target.defaultCollectionInterfaceSortedSet) + @org.hibernate.annotations.Sort(type = org.hibernate.annotations.SortType.NATURAL) +#* *##end #* *##end public $target.getterSetterTypeName ${target.getterName}() { @@ -674,6 +680,9 @@ #* *##if ($target.associationCacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${target.cacheType}) #* *##end +#* *##if ($target.defaultCollectionInterfaceSortedSet) + @org.hibernate.annotations.Sort(type = org.hibernate.annotations.SortType.NATURAL) +#* *##end #* *##end public $target.getterSetterTypeName ${target.getterName}() { |
From: Vance K. <va...@us...> - 2006-06-26 14:21:55
|
User: vancek Date: 06/06/26 07:21:51 Modified: andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fix JIRA EJB-34 - invalid entity constructure signature if the entity is without attributes but contains navigable associations Revision Changes Path 1.10 +4 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- changes.xml 26 Jun 2006 06:53:33 -0000 1.9 +++ changes.xml 26 Jun 2006 14:21:50 -0000 1.10 @@ -169,6 +169,10 @@ set. EJB3ManageableEntityAttributeFacade also extends EJB3EntityAttributeFacade. This eliminates the need for the existing overwritten methods in the manageable entity facades. </action> + <action dev="vancek" due-to="tlu" type="fix"> + Fix erroneous signature of entity constructor where no entity attributes exist but navigable associations + do exist. + </action> </release> </body> </document> \ No newline at end of file 1.34 +8 -7 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -r1.33 -r1.34 --- EntityEmbeddable.vsl 26 Jun 2006 06:37:12 -0000 1.33 +++ EntityEmbeddable.vsl 26 Jun 2006 14:21:51 -0000 1.34 @@ -239,7 +239,8 @@ * This method sets all POJO fields defined in this class to the values provided by * the parameters. * -#**##foreach($attribute in $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) +#**##set ($updatableAttributes = $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) +#**##foreach($attribute in $updatableAttributes) * @param $attribute.name Value for the ${attribute.name} property #**##end */ @@ -248,7 +249,7 @@ #**##if(!$inheritedAttributes.empty) super($entity.getAttributesAsList($inheritedAttributes, false, true, false)); #**##end -#**##foreach ($attribute in $transform.filterUpdatableAttributes($instanceAttributes, $entity.compositePrimaryKeyPresent)) +#**##foreach ($attribute in $updatableAttributes) ${attribute.setterName}(${attribute.name}); #**##end } @@ -260,20 +261,20 @@ /** * Constructor with all POJO attribute values and CMR relations. * -#* *##foreach($attribute in $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) +#* *##set ($updatableAttributes = $transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent)) +#* *##foreach($attribute in $updatableAttributes) * @param $attribute.name Value for the ${attribute.name} property #* *##end #* *##foreach ($relation in $relations) * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role #* *##end */ - public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$updatableAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) { -#* *##foreach ($attribute in $transform.filterUpdatableAttributes($instanceAttributes, $entity.compositePrimaryKeyPresent)) +#* *##foreach ($attribute in $updatableAttributes) ${attribute.setterName}(${attribute.name}); #* *##end - // Set the CMR relations #* *##foreach ($relation in $relations) ${relation.otherEnd.setterName}($relation.otherEnd.name); #* *##end |
From: Vance K. <va...@us...> - 2006-06-27 02:20:16
|
User: vancek Date: 06/06/26 19:20:14 Modified: andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: instantiate collection association end declaration with appropriate collection implementation Revision Changes Path 1.13 +2 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- changes.xml 26 Jun 2006 15:12:23 -0000 1.12 +++ changes.xml 27 Jun 2006 02:20:14 -0000 1.13 @@ -159,6 +159,8 @@ for association end collection index name and type (further map support) to be specified via tagged values @andromda.persistence.collection.index and @andromda.persistence.collection.index.type. This introduced a new facade called EJB3TypeFacade. + Every collection type association end now instantiates the corresponding implementation upon + declaration. </action> <action dev="vancek" type="fix"> Fixed isRequired in EJB3AssociationEndFacade and EJB3EntityAttributeFacade to exclude property if 1.35 +5 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -r1.34 -r1.35 --- EntityEmbeddable.vsl 26 Jun 2006 14:21:51 -0000 1.34 +++ EntityEmbeddable.vsl 27 Jun 2006 02:20:14 -0000 1.35 @@ -191,7 +191,11 @@ #**##foreach ($associationEnd in $entityRelations) #* *##set ($target = $associationEnd.otherEnd) #* *##if ($target.navigable) - private $target.getterSetterTypeName ${target.name}; +#* *##if ($target.many) + private $target.getterSetterTypeName $target.name = $target.collectionTypeImplementation; +#* *##else + private $target.getterSetterTypeName $target.name; +#* *##end #* *##end #**##end #end |
From: Vance K. <va...@us...> - 2006-06-27 05:20:31
|
User: vancek Date: 06/06/26 22:20:29 Modified: andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fixes for embedded value object associations and multiple embedded objects of the same type in a single entity JIRA EJB-32 and EJB-33 Revision Changes Path 1.14 +7 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- changes.xml 27 Jun 2006 02:20:14 -0000 1.13 +++ changes.xml 27 Jun 2006 05:20:29 -0000 1.14 @@ -184,6 +184,13 @@ confirm if @Transient, @Version, @Lob and @Basic are supported. @Column, @Temporal and @Enumerated have been confirmed to work. JIRA EJB-31 </action> + <action dev="vancek" due-to="tlu" type="add"> + Add support for embedded value object associations as well as attribute overrides. JIRA EJB-32. + </action> + <action dev="vancek" due-to="tlu" type="fix"> + Fix problem when there are two embedded value objects of the same type in the same entity. Fix for both + attribute and association overrides. JIRA EJB=33 + </action> </release> </body> </document> \ No newline at end of file 1.36 +33 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.35 retrieving revision 1.36 diff -u -w -r1.35 -r1.36 --- EntityEmbeddable.vsl 27 Jun 2006 02:20:14 -0000 1.35 +++ EntityEmbeddable.vsl 27 Jun 2006 05:20:29 -0000 1.36 @@ -418,13 +418,44 @@ #* *##end #* *##if ($attribute.containsEmbeddedObject) @javax.persistence.Embedded +## +## Render AttributeOverrides if attributes exist on the embedded object +## +#* *##if (!$attribute.type.attributes.empty) @javax.persistence.AttributeOverrides ({ #* *##foreach ($embeddedAttribute in $attribute.type.attributes) - @javax.persistence.AttributeOverride(name = "${embeddedAttribute.name}", column = @javax.persistence.Column(name = "${embeddedAttribute.columnName}"#if ($embeddedAttribute.unique), unique = ${embeddedAttribute.unique}#end#if (!$embeddedAttribute.columnNullable), nullable = ${embeddedAttribute.columnNullable}#end#**#, insertable = ${embeddedAttribute.insertEnabled}, updatable = ${embeddedAttribute.updateEnabled}#if ($embeddedAttribute.columnLength), length = ${embeddedAttribute.columnLength}#end#if ($embeddedAttribute.columnDefinition), columnDefinition = "${embeddedAttribute.columnDefinition}"#end#if ($embeddedAttribute.columnPrecision), precision = ${embeddedAttribute.columnPrecision}#end#if ($embeddedAttribute.columnScale), scale = ${embeddedAttribute.columnScale}#end))#if($velocityCount != $attribute.type.attributes.size()),#end + @javax.persistence.AttributeOverride(name = "${embeddedAttribute.name}", column = @javax.persistence.Column(name = "${attribute.columnName}_${embeddedAttribute.columnName}"#if ($embeddedAttribute.unique), unique = ${embeddedAttribute.unique}#end#if (!$embeddedAttribute.columnNullable), nullable = ${embeddedAttribute.columnNullable}#end#**#, insertable = ${embeddedAttribute.insertEnabled}, updatable = ${embeddedAttribute.updateEnabled}#if ($embeddedAttribute.columnLength), length = ${embeddedAttribute.columnLength}#end#if ($embeddedAttribute.columnDefinition), columnDefinition = "${embeddedAttribute.columnDefinition}"#end#if ($embeddedAttribute.columnPrecision), precision = ${embeddedAttribute.columnPrecision}#end#if ($embeddedAttribute.columnScale), scale = ${embeddedAttribute.columnScale}#end))#if($velocityCount != $attribute.type.attributes.size()),#end + +#* *##end + }) +#* *##end +## +## Render AssociationOverrides for embedded object if associations exist on the embedded object +## +#* *##if (!$attribute.type.associationEnds.empty) + @javax.persistence.AssociationOverrides + ({ +#* *##foreach ($associationEnd in $attribute.type.associationEnds) +#* *##set ($target = $associationEnd.otherEnd) +#* *##if (!$target.type.compositePrimaryKeyPresent) + @javax.persistence.AssociationOverride(name = "${target.name}", joinColumns = @javax.persistence.JoinColumn(name = "${attribute.columnName}_$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end))#if($velocityCount != $attribute.type.associationEnds.size()),#end + +#* *##else +#* *##set ($identifiers = $target.type.getIdentifiers()) + @javax.persistence.AssociationOverride(name = "${target.name}", + joinColumns = + { +#* *##foreach ($attribute in $identifiers) + @javax.persistence.JoinColumn(name = "${attribute.columnName}_$stringUtils.upperCase(${target.name})_${attribute.columnName}", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()),#end + +#* *##end + })#if($velocityCount != $attribute.type.associationEnds.size()),#end #* *##end +#* *##end }) +#* *##end #* *##else @javax.persistence.Column(name = "${attribute.columnName}"#if ($attribute.unique), unique = ${attribute.unique}#end#if (!$attribute.columnNullable), nullable = ${attribute.columnNullable}#end#**#, insertable = ${attribute.insertEnabled}, updatable = ${attribute.updateEnabled}#if ($attribute.columnLength), length = ${attribute.columnLength}#end#if ($attribute.columnDefinition), columnDefinition = "${attribute.columnDefinition}"#end#if ($attribute.columnPrecision), precision = ${attribute.columnPrecision}#end#if ($attribute.columnScale), scale = ${attribute.columnScale}#end) #* *##end |
From: Vance K. <va...@us...> - 2006-07-24 14:02:06
|
User: vancek Date: 06/07/24 07:02:02 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3AssociationEndFacadeLogicImpl.java andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: JIRA EJB-40 fix support for modelling map association ends Revision Changes Path 1.14 +34 -5 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java Index: EJB3AssociationEndFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- EJB3AssociationEndFacadeLogicImpl.java 24 Jul 2006 07:10:22 -0000 1.13 +++ EJB3AssociationEndFacadeLogicImpl.java 24 Jul 2006 14:02:01 -0000 1.14 @@ -264,7 +264,9 @@ */ if ("true".equals(this.getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING))) { - getterSetterTypeName = getterSetterTypeName + "<" + this.getType().getFullyQualifiedName() + ">"; + getterSetterTypeName = getterSetterTypeName + "<" + + (this.isMap()? this.getCollectionIndexType() + ", ": "") + + this.getType().getFullyQualifiedName() + ">"; } } return getterSetterTypeName; @@ -680,12 +682,39 @@ Object value = this.findTaggedValue(EJB3Profile.TAGGEDVALUE_ASSOCIATION_INDEX_TYPE); if (value == null) { + Object name = this.findTaggedValue(EJB3Profile.TAGGEDVALUE_ASSOCIATION_INDEX); + if(name == null) + { + // Find the identifier + EJB3EntityAttributeFacade identifier = ((EJB3EntityFacade)this.getOtherEnd().getType()).getIdentifer(); + value = identifier.getType().getFullyQualifiedName(); + return value.toString(); + } + else + { + // Find the attribute corresponding to name + Collection attributes = ((EJB3EntityFacade)this.getOtherEnd().getType()).getAttributes(); + Iterator it = attributes.iterator(); + while(it.hasNext()) + { + EJB3EntityAttributeFacade attribute = (EJB3EntityAttributeFacade) it.next(); + if(attribute.getName().equals(name)) + { + value = attribute.getType().getFullyQualifiedName(); + return value.toString(); + } + } + } + + if (value == null) + { value = this.getConfiguredProperty(COLLECTION_INDEX_TYPE); if (StringUtils.isBlank(ObjectUtils.toString(value))) { value = null; } } + } if (value != null) { 1.25 +8 -0 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -r1.24 -r1.25 --- changes.xml 24 Jul 2006 07:10:22 -0000 1.24 +++ changes.xml 24 Jul 2006 14:02:02 -0000 1.25 @@ -259,6 +259,14 @@ composition end. The non-navigable end is assumed to be the owning end of the association. This fix renders the mappedBy property for OneToOne annotations on the inverse side of the association. </action> + <action dev="vancek" due-to="sverker" type="fix"> + JIRA EJB-40 - Fix support for modelling map associations ends. + "The attached patch solves this issue as well as providing an improvement in regards to List associations. + If no OrderBy tagged value is provided, the IndexColumn annotation is used (hibernate extension) to provide + true list association." - The hibernate annotation needs to be switched depending on the persistence + provider. This will be fixed once a namespace property is introduced along the lines of + persistenceProvider. + </action> </release> </body> </document> \ No newline at end of file 1.38 +24 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -r1.37 -r1.38 --- EntityEmbeddable.vsl 1 Jul 2006 10:13:01 -0000 1.37 +++ EntityEmbeddable.vsl 24 Jul 2006 14:02:02 -0000 1.38 @@ -593,12 +593,21 @@ #* *##else #* *##set ($argExists = false) @javax.persistence.OneToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($associationEnd.navigable)#if ($argExists) ,#end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) +#* *##if ($target.map) + @javax.persistence.MapKey#if ($target.hasTaggedValue("@andromda.persistence.collection.index"))(name = "${target.collectionIndexName}")#end + +#* *##else #* *##if ($target.hasTaggedValue("@andromda.persistence.orderBy")) #* *##if ($stringUtils.isNotEmpty(${target.orderByClause})) @javax.persistence.OrderBy("${target.orderByClause}") #* *##else @javax.persistence.OrderBy #* *##end +#* *##else +#* *##if ($target.list) + @org.hibernate.annotations.IndexColumn(name = "${target.collectionIndexName}") +#* *##end +#* *##end #* *##end #* *##if ($target.associationCacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${target.cacheType}) @@ -711,12 +720,21 @@ ) #* *##end #* *##end +#* *##if ($target.map) + @javax.persistence.MapKey#if ($target.hasTaggedValue("@andromda.persistence.collection.index"))(name = "${target.collectionIndexName}")#end + +#* *##else #* *##if ($target.hasTaggedValue("@andromda.persistence.orderBy")) #* *##if ($stringUtils.isNotEmpty(${target.orderByClause})) @javax.persistence.OrderBy("${target.orderByClause}") #* *##else @javax.persistence.OrderBy #* *##end +#* *##else +#* *##if ($target.list) + @org.hibernate.annotations.IndexColumn(name = "${target.collectionIndexName}") +#* *##end +#* *##end #* *##end #* *##if ($target.associationCacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${target.cacheType}) |
From: Vance K. <va...@us...> - 2006-10-08 14:34:00
|
User: vancek Date: 06/10/08 07:34:00 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fix EJB3EntityFacade.identifier naming Revision Changes Path 1.40 +2 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.39 retrieving revision 1.40 diff -u -w -r1.39 -r1.40 --- EntityEmbeddable.vsl 25 Jul 2006 06:42:51 -0000 1.39 +++ EntityEmbeddable.vsl 8 Oct 2006 14:34:00 -0000 1.40 @@ -218,7 +218,7 @@ #**##foreach ($associationEnd in $entityRelations) #* *##set ($target = $associationEnd.otherEnd) #* *##if ($target.navigable) -#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifer.name) +#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifier.name) #* *##if ($target.many) private java.util.Collection<${target.type.manageableDisplayAttribute.type.fullyQualifiedName}> ${target.labelName}; // Manageable display attribute #* *##else @@ -789,7 +789,7 @@ ## on getter. A display attribute differs from the identifier if modelled by ## the Unique stereotype. ## -#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifer.name) +#* *##if ($target.type.manageable && $target.type.manageableDisplayAttribute.name != $target.type.identifier.name) #* *##if ($velocityCount == 1) // -------- Manageable Attribute Display ----------- |
From: Vance K. <va...@us...> - 2006-10-09 04:08:51
|
User: vancek Date: 06/10/08 21:08:51 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3ManageableEntityFacadeLogicImpl.java EJB3EntityFacadeLogicImpl.java andromda-ejb3/src/changes changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: jira EJB-45 fix for failure to use correct metafacade when adding Manageable stereotype for UML2 Revision Changes Path 1.8 +64 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3ManageableEntityFacadeLogicImpl.java Index: EJB3ManageableEntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3ManageableEntityFacadeLogicImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EJB3ManageableEntityFacadeLogicImpl.java 8 Oct 2006 15:23:57 -0000 1.7 +++ EJB3ManageableEntityFacadeLogicImpl.java 9 Oct 2006 04:08:51 -0000 1.8 @@ -1,13 +1,17 @@ package org.andromda.cartridges.ejb3.metafacades; import java.text.MessageFormat; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; +import java.util.List; import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.EntityAttribute; import org.andromda.metafacades.uml.UMLProfile; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; @@ -240,4 +244,64 @@ } return rolesAllowed != null ? rolesAllowed.toString() : null; } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3ManageableEntityFacadeLogic#getIdentifier() + * + * Override the implemenation in EJB3EntityFacade as UML2 models cannot retrieve the identifier via the + * super EJB3EntityFacade. + */ + public EJB3EntityAttributeFacade getIdentifier() + { + return (EJB3EntityAttributeFacade)super.getIdentifiers().iterator().next(); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3ManageableEntityFacadeLogic#getAllInstanceAttributes() + * + * Override the implemenation in EJB3EntityFacade as UML2 models will not get an + * EJB3ManageableEntityAttributeFacade when retrieving the attributes. + */ + public List getAllInstanceAttributes() + { + return EJB3MetafacadeUtils.getAllInstanceAttributes(this); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3ManageableEntityFacadeLogic#getInheritedInstanceAttributes() + * + * Override the implemenation in EJB3EntityFacade as UML2 models will not get an + * EJB3ManageableEntityAttributeFacade when retrieving the attributes. + */ + public List getInheritedInstanceAttributes() + { + return EJB3MetafacadeUtils.getInheritedInstanceAttributes(this); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3ManageableEntityFacadeLogic# + * getInstanceAttributes(boolean, boolean) + * + * Override the implemenation in EJB3EntityFacade as UML2 models will not get an + * EJB3ManageableEntityAttributeFacade when retrieving the attributes. + */ + public Collection getInstanceAttributes(boolean follow, boolean withIdentifiers) + { + final Collection attributes = this.getAttributes(follow, withIdentifiers); + CollectionUtils.filter( + attributes, + new Predicate() + { + public boolean evaluate(Object object) + { + boolean valid = true; + if (object instanceof EntityAttribute) + { + valid = !((EntityAttribute)object).isStatic(); + } + return valid; + } + }); + return attributes; + } } \ No newline at end of file 1.27 +18 -10 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java Index: EJB3EntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -r1.26 -r1.27 --- EJB3EntityFacadeLogicImpl.java 8 Oct 2006 13:52:34 -0000 1.26 +++ EJB3EntityFacadeLogicImpl.java 9 Oct 2006 04:08:51 -0000 1.27 @@ -6,6 +6,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashSet; +import java.util.List; import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.cartridges.ejb3.EJB3Profile; @@ -1391,15 +1392,22 @@ boolean follow, boolean withIdentifiers) { - return new FilteredCollection(this.getAttributes(follow, withIdentifiers)) + final Collection attributes = this.getAttributes(follow, withIdentifiers); + CollectionUtils.filter( + attributes, + new Predicate() { - private static final long serialVersionUID = -8511475954374453779L; - public boolean evaluate(Object object) { - return !((AttributeFacade)object).isStatic(); + boolean valid = true; + if (object instanceof EntityAttribute) + { + valid = !((EntityAttribute)object).isStatic(); } - }; + return valid; + } + }); + return attributes; } /** 1.38 +7 -1 cartridges/andromda-ejb3/src/changes/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/changes/changes.xml,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -r1.37 -r1.38 --- changes.xml 8 Oct 2006 15:23:57 -0000 1.37 +++ changes.xml 9 Oct 2006 04:08:51 -0000 1.38 @@ -295,7 +295,7 @@ </action> <action dev="vancek" type="fix"> EJB3MessageDrivenFacade.getDestinationType requires search and replace for destination type retrieved - from TV. i.e. replace all '_' with '.'. + from TV. i.e. replace all '_' with '.'. Also fix casing for javax.jms.Queue and javax.jms.Topic. </action> <action dev="vancek" type="add"> UMLMETA-78 - Add support for member variables within type safe enumerations. @@ -307,6 +307,12 @@ Fix getIdentifier naming in EJB3EntityFacade which eliminates the workaround solution in EJB3ManageableEntityFacade. </action> + <action dev="vancek" due-to="markh" type="fix"> + JIRA EJB-45 - ClassCastException when setting Manageable stereotype on entities. The + EJB3ManageableEntityAttributeFacade was not being picked up correctly. Instead, the + emf.uml2.ManageableEntityAttributeFacade was used. The fix was to simply override the methods returning + attributes and identifiers in EJB3ManageableEntityFacade. + </action> </release> </body> </document> \ No newline at end of file 1.41 +3 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.40 retrieving revision 1.41 diff -u -w -r1.40 -r1.41 --- EntityEmbeddable.vsl 8 Oct 2006 14:34:00 -0000 1.40 +++ EntityEmbeddable.vsl 9 Oct 2006 04:08:51 -0000 1.41 @@ -21,7 +21,7 @@ #**##set ($generatedFile = "${stringUtils.replace($entity.fullyQualifiedEntityName,'.','/')}.java") #end -#set ($identifier = $entity.identifiers.iterator().next()) +#set ($identifier = $entity.identifier) /** * Autogenerated POJO EJB#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) mapped super#end class for ${entity.entityName} containing the * bulk of the entity implementation. @@ -146,14 +146,14 @@ #**##end #end ## -## Only declase instance attributes that are NOT inherited. +## Only declare instance attributes that are NOT inherited. ## If a mapped superclass then don't generate auto identifier - but include ## normal defined identifier if one is defined. ## #if ($entity.embeddableSuperclass && $entity.dynamicIdentifiersPresent) #**##set ($attributes = $entity.getInstanceAttributes(false, false)) #else -#**##set ($attributes = $entity.instanceAttributes) +#**##set ($attributes = $entity.getInstanceAttributes(false, true)) #end #if (!$attributes.empty) @@ -242,7 +242,6 @@ ## Autogenerate a constructor implementation with all attributes. #set ($allAttributes = $transform.filterByVisibility($entity.allInstanceAttributes, "public")) #set ($inheritedAttributes = $transform.filterByVisibility($entity.inheritedInstanceAttributes, "public")) -#set ($instanceAttributes = $transform.filterByVisibility($entity.instanceAttributes, "public")) #if ($entity.syntheticCreateMethodAllowed && !$transform.filterUpdatableAttributes($allAttributes, $entity.compositePrimaryKeyPresent).empty) /** * Implementation for the constructor with all POJO attributes except auto incremented identifiers. |
From: Vance K. <va...@us...> - 2006-12-07 01:09:56
|
User: vancek Date: 06/12/06 17:09:54 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: JIRA-48 fix incorrect spelling for generator sequence and table types Revision Changes Path 1.42 +5 -5 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.41 retrieving revision 1.42 diff -u -w -r1.41 -r1.42 --- EntityEmbeddable.vsl 9 Oct 2006 04:08:51 -0000 1.41 +++ EntityEmbeddable.vsl 7 Dec 2006 01:09:53 -0000 1.42 @@ -401,13 +401,13 @@ #* *##elseif (!$attribute.version) #* *##if ($attribute.identifier) @javax.persistence.Id -#* *##if ($attribute.sequenceGeneratorType) - @javax.persistence.SequenceGenerator(name = "${attribute.generatorName}"#if ($attribute.sequenceGeneratorType), sequenceName = "${attribute.generatorSourceName}"#end#if ($attribute.sequenceGeneratorType), initialValue = ${attribute.generatorInitialValue}#end#if ($attribute.generatorAllocationSize), allocationSize = ${attribute.generatorAllocationSize}#end) -#* *##elseif ($attribute.tableGeneratorType) - @javax.persistence.TableGenerator(name = "${attribute.generatorName}"#if ($attribute.tableGeneratorType), table = "${attribute.generatorSourceName}"#end#if ($attribute.generatorPkColumnValue), pkColumnValue = "${attribute.generatorPkColumnValue}"#end#if ($attribute.generatorInitialValue), initialValue = ${attribute.generatorInitialValue}#end#if ($attribute.generatorAllocationSize), allocationSize = ${attribute.generatorAllocationSize}#end) +#* *##if ($attribute.generatorTypeSequence) + @javax.persistence.SequenceGenerator(name = "${attribute.generatorName}"#if ($attribute.generatorTypeSequence), sequenceName = "${attribute.generatorSourceName}"#end#if ($attribute.generatorTypeSequence), initialValue = ${attribute.generatorInitialValue}#end#if ($attribute.generatorAllocationSize), allocationSize = ${attribute.generatorAllocationSize}#end) +#* *##elseif ($attribute.generatorTypeTable) + @javax.persistence.TableGenerator(name = "${attribute.generatorName}"#if ($attribute.generatorTypeTable), table = "${attribute.generatorSourceName}"#end#if ($attribute.generatorPkColumnValue), pkColumnValue = "${attribute.generatorPkColumnValue}"#end#if ($attribute.generatorInitialValue), initialValue = ${attribute.generatorInitialValue}#end#if ($attribute.generatorAllocationSize), allocationSize = ${attribute.generatorAllocationSize}#end) #* *##end #* *##if (!$attribute.generatorTypeNone) - @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.${attribute.generatorType}#if ($attribute.sequenceGeneratorType || $attribute.tableGeneratorType), generator = "${attribute.generatorName}"#end) + @javax.persistence.GeneratedValue(strategy = javax.persistence.GenerationType.${attribute.generatorType}#if ($attribute.generatorTypeSequence || $attribute.generatorTypeTable), generator = "${attribute.generatorName}"#end) #* *##end #* *##end #* *##if ($attribute.lob) |
From: Vance K. <va...@us...> - 2007-03-26 12:01:13
|
User: vancek Date: 07/03/26 05:01:06 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fix support for abstract entity class declaration by modelliing entity as abstract (not mapped or having an implementation) Revision Changes Path 1.12 +8 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- changes.xml 18 Feb 2007 10:43:08 -0000 1.11 +++ changes.xml 26 Mar 2007 12:01:05 -0000 1.12 @@ -390,6 +390,14 @@ Set default topic subscription durability as NonDurable in case a Topic does not have the subscription durability TV modelled. </action> + <action dev="vancek" due-to="heapifyman" type="fix"> + Fix entity constructor generation when no attributes modelled but operation and associations exist. + </action> + <action dev="vancek" due-to="jonnyBgood" type="fix"> + Fix support for abstract super entity (add super to class declaration) even when super entity is not a + mapped superclass or specializes another entity. This also cleaned up the constructor implementation in + the inheriting entity. + </action> </release> </body> </document> \ No newline at end of file 1.46 +1 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.45 retrieving revision 1.46 diff -u -w -r1.45 -r1.46 --- EntityEmbeddable.vsl 28 Feb 2007 00:56:18 -0000 1.45 +++ EntityEmbeddable.vsl 26 Mar 2007 12:01:06 -0000 1.46 @@ -119,7 +119,7 @@ #* *##end #**##end #end -public#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) abstract class ${entity.entityEmbeddableName}#else class ${entity.entityName}#end +public#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) abstract class ${entity.entityEmbeddableName}#else#if($entity.abstract) abstract#end class ${entity.entityName}#end #if($entity.requiresGeneralizationMapping) #**##if($entity.embeddableSuperclassGeneralizationExists) @@ -258,9 +258,6 @@ */ public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)) { -#**##if(!$inheritedAttributes.empty) - super($entity.getAttributesAsList($inheritedAttributes, false, true, false)); -#**##end #**##foreach ($attribute in $updatableAttributes) ${attribute.setterName}(${attribute.name}); #**##end |
From: Vance K. <va...@us...> - 2007-04-29 12:34:30
|
User: vancek Date: 07/04/29 05:34:29 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: ejb-54 - fix entity class level annotations for multi-level single table inheritance hierarchy Revision Changes Path 1.15 +6 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- changes.xml 25 Apr 2007 03:47:49 -0000 1.14 +++ changes.xml 29 Apr 2007 12:34:28 -0000 1.15 @@ -446,6 +446,12 @@ when a topic is durable, removal of minPoolSize activation config and rename of maxPoolSize to maxSession activation config. Reference http://galaxy.andromda.org/forum/viewtopic.php?p=21537#21537. </action> + <action dev="vancek" due-to="khwalk" type="fix"> + JIRA EJB-54 - Fix entity level annotations for multiple level single table inheritance hierarchy. When generating a one + level hierarchy, the @Table and @DiscriminatorColumn annotations exist on the top level entity. However, + when there is a multi-level single table inhiertance hierarchy, these 2 annotations exist on every parent + entity. + </action> </release> </body> </document> \ No newline at end of file 1.48 +8 -3 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.47 retrieving revision 1.48 diff -u -w -r1.47 -r1.48 --- EntityEmbeddable.vsl 16 Apr 2007 14:09:38 -0000 1.47 +++ EntityEmbeddable.vsl 29 Apr 2007 12:34:29 -0000 1.48 @@ -56,13 +56,15 @@ #**##end ## ## Include the Table annotation for a base class in single table inheritence hierarchy -## but not in the subclasses. Include in all classes for joined and table per class +## but not in the subclasses, regardless of multiple levels in the inhiertance hierarchy. +## +## Include in all classes for joined and table per class ## inheritance hierarchies. ## ## If a class is manually specified as an embeddable superclass, add ## the Table annotation to the subclass, not to the base superclass. ## -#**##if (!$entity.entityImplementationRequired && ($entity.requiresSpecializationMapping || !$entity.requiresGeneralizationMapping || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) +#**##if (!$entity.entityImplementationRequired && (($entity.requiresSpecializationMapping && !$entity.requiresGeneralizationMapping) || !$entity.requiresGeneralizationMapping || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) @javax.persistence.Table(name = "${entity.tableName}") #**##end #**##if ($entity.listenerEnabled) @@ -72,7 +74,10 @@ ## Only include the inheritance related annotations for inheritance mapping ## that doesn't involve embeddable superclass hierarchy. ## -#**##if ($entity.requiresSpecializationMapping) +## Only include the inheritance and discriminator column mapping for the top level class +## in the hierarchy, regardless of the number of levels in the hierarchy. +## +#**##if ($entity.requiresSpecializationMapping && !$entity.requiresGeneralizationMapping) @javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.${entity.inheritanceStrategy}) ## ## Discriminator components only apply to single table mapping strategy |
From: Vance K. <va...@us...> - 2007-06-14 15:06:13
|
User: vancek Date: 07/06/14 08:06:14 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/test/expected cartridge-output.zip andromda-ejb3/src/test/uml EJB3CartridgeTestModel.xml.zip andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: ejb-50 - fix optimistic locking on version attribute Revision Changes Path 1.21 +4 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- changes.xml 14 Jun 2007 14:38:28 -0000 1.20 +++ changes.xml 14 Jun 2007 15:06:08 -0000 1.21 @@ -477,6 +477,10 @@ <action dev="vancek" type="update"> Fix naming of the serviceRemoteInterfaceName property to serviceRemoteInterfaceNamePattern. </action> + <action dev="vancek" due-to="dima" type="fix"> + JIRA EJB-55 - Fix optimistic locking - version attribute. Set the annotation on the getter and change + modifier on version attribute to public. + </action> </release> </body> </document> \ No newline at end of file 1.11 +492 -472 cartridges/andromda-ejb3/src/test/expected/cartridge-output.zip <<Binary file>> 1.7 +268 -313 cartridges/andromda-ejb3/src/test/uml/EJB3CartridgeTestModel.xml.zip <<Binary file>> 1.52 +7 -7 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.51 retrieving revision 1.52 diff -u -w -r1.51 -r1.52 --- EntityEmbeddable.vsl 13 Jun 2007 16:31:35 -0000 1.51 +++ EntityEmbeddable.vsl 14 Jun 2007 15:06:14 -0000 1.52 @@ -190,16 +190,11 @@ #* *##set ($doAttribute = true) #* *##end #* *##if ($doAttribute) -#* *##if (!$attribute.transient && $attribute.version) -## -## Add the Version annotation on the attribute itself -## - @javax.persistence.Version -#* *##end ## ## Check for overriding LOB type +## If the attribute is used in optimistic locking, make public, otherwise make private ## - private #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name; + #if (!$attribute.transient && $attribute.version)public#else#**#private#end #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name; #* *##end #**##end @@ -506,6 +501,11 @@ @org.hibernate.validator.Length(max = $attribute.columnLength) #* *##end #* *##end +#* *##else +## +## Add the Version annotation on the attribute itself +## + @javax.persistence.Version #* *##end ## ## Override attribute type if attribute is a LOB and lob type is specified |
From: Vance K. <va...@us...> - 2007-06-23 09:07:34
|
User: vancek Date: 07/06/23 02:07:36 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/test/expected cartridge-output.zip andromda-ejb3/src/test/uml EJB3CartridgeTestModel.xml.zip andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: fix for child entity with an implementation extending a parent mapped superclass Revision Changes Path 1.23 +5 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- changes.xml 23 Jun 2007 08:06:44 -0000 1.22 +++ changes.xml 23 Jun 2007 09:07:35 -0000 1.23 @@ -484,6 +484,11 @@ <action dev="vancek" due-to="heapifyman" type="add"> JIRA EJB-56 - Add support for multiplicity on enumeration types. </action> + <action dev="vancek" tue-to="mrkanban" type="fix"> + When a child entity inherits from a mapped superclass and the child entity has an implementation, the + child mapped superclass did not extend the parent mapped superclass correctly. This was a side-effect of + applying EJB-53. + </action> </release> </body> </document> \ No newline at end of file 1.13 +505 -480 cartridges/andromda-ejb3/src/test/expected/cartridge-output.zip <<Binary file>> 1.8 +259 -272 cartridges/andromda-ejb3/src/test/uml/EJB3CartridgeTestModel.xml.zip <<Binary file>> 1.53 +1 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.52 retrieving revision 1.53 diff -u -w -r1.52 -r1.53 --- EntityEmbeddable.vsl 14 Jun 2007 15:06:14 -0000 1.52 +++ EntityEmbeddable.vsl 23 Jun 2007 09:07:36 -0000 1.53 @@ -131,7 +131,7 @@ public#if ($entity.entityImplementationRequired) abstract class ${entity.entityEmbeddableName}#else#if($entity.abstract) abstract#end class ${entity.entityName}#end #if($entity.requiresGeneralizationMapping) -#**##if($entity.embeddableSuperclassGeneralizationExists && $entity.entityImplementationRequired) +#**##if($entity.embeddableSuperclassGeneralizationExists && $entity.generalization.entityImplementationRequired) extends ${entity.generalization.fullyQualifiedEntityEmbeddableName} #**##else extends ${entity.generalization.fullyQualifiedName} |