@Transformation - Unknown state or association field [message #386019] |
Thu, 19 March 2009 13:22 |
Josh Davis Messages: 10 Registered: July 2009 |
Junior Member |
|
|
I have a class that uses a Transformation mapping for the IP address
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.
Internal Exception: java.sql.SQLException: ORA-00904: "IPADDR": invalid
identifier
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.
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04169 seconds