openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Tan <peter_...@hotmail.com>
Subject Convert boolean to String type using ExternalValues
Date Mon, 15 Dec 2008 09:24:13 GMT

Hi,

I have a boolean field that I'd like to map to a string column in DB, so I wrote the following
annotation:

    @ExternalValues({"true=TRUE", "false=FALSE"})
    @Type(String.class)
    @Column(name="is_verified")
    private boolean isVerified;

And I got ClassCastException:

Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
    at org.apache.openjpa.enhance.ReflectingPersistenceCapable.pcProvideField(ReflectingPersistenceCapable.java:126)
    at org.apache.openjpa.kernel.StateManagerImpl.provideField(StateManagerImpl.java:3012)
    at org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2827)
    at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
    ... 29 more

Somehow the external value transfer didn't happen and the type cast failed. Any idea?

thank you
-Peter
 

_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message