History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: EJB-31
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vance Karimi
Reporter: Torsten Lunze
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
EJB Cartridge

EJB3: Attribute Annotation in EmbeddeValue

Created: 20/Jun/06 12:59 PM   Updated: 26/Jun/06 05:09 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File EmbeddedValue.vsl (6 kb)

Environment: Andromda 3.2, EJB3 Cartridge


 Description   
Add annotations for enumeration type, temporal type column definition to EmbeddedValue.vsl

 All   Comments   Change History      Sort Order:
Comment by Torsten Lunze [20/Jun/06 01:12 PM]
I added the following to EmbeddedValues.vsl (just copying from EntityEmbeddable.vsl) I have been very optimistic and did not checked if all the feature the template will have will be supported by the EJB3 spec. Thinking about LOB, transient, version, fetch type. What I needed is the enumeration.type and temporal.type.

##
## If attribute is transient ONLY add Transient annotation
##
#* *##if ($attribute.transient)
    @javax.persistence.Transient
#* *##else
#* *##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.
## Also sepcify Fetch type in Basic annotation if set to EAGER since
## default fetch type for LOB annotation is LAZY.
##
    @javax.persistence.Lob
#* *##if ($attribute.eager)
    @javax.persistence.Basic(fetch = javax.persistence.FetchType.EAGER)
#* *##end
#* *##end
    @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)
#* *##if (!$attribute.lob && $attribute.lazy)
##
## Only add the fetch type property for LAZY hints - default is EAGER
##
    @javax.persistence.Basic(fetch = javax.persistence.FetchType.LAZY)
#* *##end
#* *##if ($stringUtils.isNotBlank($attribute.temporalType))
    @javax.persistence.Temporal(javax.persistence.TemporalType.${attribute.temporalType})
#* *##end
#* *##if ($stringUtils.isNotBlank($attribute.enumerationType))
    @javax.persistence.Enumerated(javax.persistence.EnumType.${attribute.enumerationType})
#* *##end
#* *##end
##
## Override attribute type if attribute is a LOB and lob type is specified
##

Comment by Torsten Lunze [20/Jun/06 01:14 PM]
I forgot to mention, in the file i uploaded be aware that I also changed the constructor to public and removed the abstrac as a workaround for #EJB-29.

Comment by Vance Karimi [26/Jun/06 05:09 PM]
Fix applied in CVS.
Need to test @Transient, @Version, @Lob and @Basic, but it shouldn't cause any issues to keep until someone has tested.
Thanks Torsten :)