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 |