Hi Andrei

What do you mean by reseting the version field to null?

The application should not update the version field (nor should it need to).
OpenJPA will update the version for you automatically, if the application is
calling setVersion(1) then that could cause problems. Off the top of my head
I don't think it would manifest as a ClassCastException though.

Do you have the corresponding @ManyToOne annotation on PLSRelationship?

-mike


On Tue, Mar 17, 2009 at 7:45 AM, Andrei Tchijov <[email protected]> wrote:

>
> Out of blue, I started to get following exception:
> http://n2.nabble.com/file/n2491173/ClassCastException.txt
> ClassCastException.txt .
>
> To the best of my understanding, problem occur when I am trying to access
> @OneToMany field defined as following:
>
>        @OneToMany(     mappedBy = "object", cascade = ALL  )
>        @MapKey(name = "name")
>        private Map<String,PLSRelationship> relationships;
>
>
> What was particularly weird, I have quite a few objects in the data base
> and
> this exception was happening only when I was trying to access particular 2
> of these objects.  It was quite persistent too.  It always was happening
> when I was trying to access these 2 particular objects.
>
> I was trying to figure out what was so special about these 2 objects and
> the
> only thing I could see was that "@Version" field in records representing
> one
> of PLSRelationship "related" to objects which were giving me an exception
> were non null ( it was "1" ). On the wimp, I have reset value of all
> "@Version" fields to null and now it works without any problems.
>
> I would greatly appreciate if some one can shade some light on this issue.
> Obviously, I am doing something wrong and manage to get my data base into
> state which OpenJPA did not like much.  The problem is that I have no idea
> what exactly I did wrong (and how to prevent it from happening).
>
> You comments will be highly appreciated,
>
> Andrei
>
> P.S. I am running OpenJPA 1.2.0 with mySQL.  All classes are enchanted
> during build time (using ant task).
> --
> View this message in context:
> http://n2.nabble.com/Strange-%22ClassCast%22-Exception-%28and-even-stranger-way-it-disappear%29-tp2491173p2491173.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to