Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » <transformation> tag documentation?
<transformation> tag documentation? [message #525832] Wed, 07 April 2010 22:13 Go to next message
Tim is currently offline TimFriend
Messages: 2
Registered: April 2010
Junior Member
I'm using scala and jpa together. It works quite well, except that scala doesn't yet support nested annotation.

As a result I have to define all my transformations in xml. This is ok, except I'm not really sure what the transformation element's name attribute is for in this xml format. It doesn't clearly map to any part of the java annotation. I also can't find any clear documentation on configuring eclipselink through the orm.xml file.

Any help is appreciated.
Re: <transformation> tag documentation? [message #527037 is a reply to message #525832] Tue, 13 April 2010 19:26 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The link to all our schemas is here,

http://wiki.eclipse.org/EclipseLink/XSDs

The transformation is,
<xsd:complexType name="transformation">
<xsd:annotation>
<xsd:documentation>


/**
* Transformation is an optional annotation for
* org.eclipse.persistence.mappings.TransformationMapping.
* TransformationMapping allows to map an attribute to one or more
* database columns.
*
* Transformation annotation is an optional part of
* TransformationMapping definition. Unless the TransformationMapping is
* write-only, it should have a ReadTransformer, it defines
* transformation of database column(s) value(s)into attribute value.
* Also unless it's a read-only mapping, either WriteTransformer
* annotation or WriteTransformers annotation should be specified. Each
* WriteTransformer defines transformation of the attribute value to a
* single database column value (column is specified in the
* WriteTransformer).
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Transformation {
/**
* (Optional) Defines whether the value of the field or property
* should be lazily loaded or must be eagerly fetched. The EAGER
* strategy is a requirement on the persistence provider runtime
* that the value must be eagerly fetched. The LAZY strategy is a
* hint to the persistence provider runtime. If not specified,
* defaults to EAGER.
*/
FetchType fetch() default EAGER;

/**
* (Optional) The optional element is a hint as to whether the value
* of the field or property may be null. It is disregarded
* for primitive types, which are considered non-optional.
*/
boolean optional() default true;
}


</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="read-transformer" type="orm:read-transformer"/>
<xsd:element name="write-transformer" type="orm:write-transformer" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="access" type="orm:access-type" minOccurs="0"/>
<xsd:element name="property" type="orm:property" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="access-methods" type="orm:access-methods" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="fetch" type="orm:fetch-type"/>
<xsd:attribute name="optional" type="xsd:boolean"/>
<xsd:attribute name="access" type="orm:access-type"/>
<xsd:attribute name="mutable" type="xsd:boolean"/>
</xsd:complexType>


James : Wiki : Book : Blog : Twitter
Re: <transformation> tag documentation? [message #541763 is a reply to message #525832] Tue, 22 June 2010 13:15 Go to previous message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Tim,

I am just wrapping up a new version of the employee demo using an eclipselink-orm.xml mapping file.

It is currently in the SVN repository at:

http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/br anches/2.1/trunk/examples/jpa.employee/eclipselink.example.j pa.employee.xml/

The mapping file I am using is at:

http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/br anches/2.1/trunk/examples/jpa.employee/eclipselink.example.j pa.employee.xml/src/META-INF/eclipselink-orm.xml

The <transformation> mapping is not very commonly used. I would recommend using a Converter. You will see in the example I use one to convert M<->Male and F<->Female on the Employee's gender.

Doug
Previous Topic:INSERT outside of transaction?
Next Topic:native id generator
Goto Forum:
  


Current Time: Thu Dec 18 11:38:46 GMT 2014

Powered by FUDForum. Page generated in 0.01824 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software