openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandhya Turaga <turagasa...@yahoo.com>
Subject Re: Convert boolean to String type using ExternalValues
Date Mon, 15 Dec 2008 19:24:01 GMT
Hi Peter,

    I tested the scenario that you mentioned but it worked fine. Could you give me your
testcase to reproduce the problem? Pls have a look at my simple testcase that I wrote to reproduce
the problem. Which version of openjpa are you using?


Thanks
Sandhya

--- On Mon, 12/15/08, peter_tan <peter_tan@hotmail.com> wrote:
From: peter_tan <peter_tan@hotmail.com>
Subject: Convert boolean to String type using ExternalValues
To: users@openjpa.apache.org
Date: Monday, December 15, 2008, 9:55 AM







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


_________________________________________________________________
Suspicious message? There’s an alert for that. 
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008
-- 
View this message in context:
http://n2.nabble.com/Convert-boolean-to-String-type-using-ExternalValues-tp1659215p1659215.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



      
Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message