Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums@Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386019/#msg_386019
field. The IP address is the string dot notation in the class, but is a
long integer in the database. My entity class looks like this:
@Entity
@Table(name="LOCATION_MAP")
public class LocationMap implements Serializable {
@Transformation
@ReadTransformer(IPAttributeTransformer.class)
@WriteTransformer(IPAttributeTransformer.class)
@Column(name="IP_ADDR")
protected String ipAddr;
...
}
IPAttributeTransformer is a class that implements both
org.eclipse.persistence.mappings.transformers.AttributeTrans fomer and
org.eclipse.persistence.mappings.transformers.FieldTransform er.
When I attempt to execute the query, "select location.ipAddr from
LocationMap location", it gives me the error Error compiling the query
(select location.ipAddr from LocationMap location), line 1, column 16:
unknown state or association field (ipAddr) of class
(com.example.LocationMap).
If I comment out the @Transformation, @ReadTransformer, and
@WriteTransformer annotations, then I don't get the error, but of course I
also don't get the transformed IP address.
If I change my query to "select location from locationMap location",
selecting the whole object instead of just the one field, I get a
different error.
Error Code: 904
Call: SELECT LOCATION_ID AS LOCATION_ID1, CREATE_TIME AS CREATE_TIME2,
UPDATE_TIME AS UPDATE_TIME3, COUNTRY_ID AS COUNTRY_ID4, STATE_ID AS
STATE_ID5, CITY_ID AS CITY_ID6, ipAddr AS ipAddr7
The column name should be IP_ADDR, but it is inserting the attribute name
instead.]]>Josh Davis2009-03-19T13:22:12-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386044/#msg_386044
removing the @Transformation annotation as it is not required once the
@WriteTransformation and/or @ReadTransformation annotations are specified.
Please file a bug.]]>Gordon Yorke2009-03-19T14:31:10-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386045/#msg_386045
Gordon Yorke2009-03-19T14:32:32-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386046/#msg_386046
@Entity
@Table(name="LOCATION_MAP")
public
class LocationMap implements Serializable {
Transformation mapping ignores the @Column annotation applied to the
field. The @Column annotation must appear inside the @WriteTranformer
annotation.
I already filed a bug last week. I'll go close it now.]]>Josh Davis2009-03-19T14:47:21-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386047/#msg_386047
should be addressed.]]>Gordon Yorke2009-03-19T14:54:11-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386048/#msg_386048
mapping type showing how to use annotations. I looked for such, but
couldn't find it.
I had filed the bug on Oracle BugDB under TopLink, bug number 8339175.]]>Josh Davis2009-03-19T15:46:26-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386049/#msg_386049
My change made it so that "select location from Location location" works
now, but "select location.ipAddr from Location location" still gives
Unknown state or association.]]>Josh Davis2009-03-19T19:06:55-00:00Re: @Transformation - Unknown state or association field
https://www.eclipse.org/forums/index.php/mv/msg/125846/386056/#msg_386056
they are currently not supported in queries. Feel free to log a bug for
this, however in general you should not use a @Transformation if you only
have a single column, just use a Converter (@Convert), it is much simpler
than using a TransformationMapping. A TransformationMapping should only
be use if you are mapping multiple columns to a single attribute, or
mapping a column without an attribute.