Skip to main content

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,

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

* 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})
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: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: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"/>

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

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: anches/2.1/trunk/examples/jpa.employee/eclipselink.example.j pa.employee.xml/

The mapping file I am using is at: 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.

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

Current Time: Sun May 20 14:12:20 GMT 2018

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

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

Back to the top