You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by olyalikov <ol...@alcatel-lucent.com> on 2014/09/10 16:26:36 UTC
EntityManager.find ClassCastException for wrong but existing id
Hello,
I have base entity and 2 inheritors e.g. Person and Document.
If I try to find Person entity and provide id of the Document entity I get
ClassNotFoundException but it should return either null or
EntityNotFoundException.
If I provide just some wrong non existing id I get null.
Here is link to the maven project with test: openjpa-find-test.zip
<http://openjpa.208410.n2.nabble.com/file/n7587085/openjpa-find-test.zip>
Should I post a bug in issue tracker?
Thanks,
Oleg
--
View this message in context: http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: EntityManager.find ClassCastException for wrong but existing id
Posted by olyalikov <ol...@alcatel-lucent.com>.
Created: https://issues.apache.org/jira/browse/OPENJPA-2528
Rick Curtis wrote
> I looked at your test, and it looks like an OpenJPA bug. I'd suggest
> opening a JIRA[1] and attach your test case.
>
> Thanks,
> Rick
>
> [1] https://issues.apache.org/jira/browse/OPENJPA
>
> On Thu, Sep 11, 2014 at 2:38 AM, olyalikov <
> oleg.lyalikov@
> > wrote:
>
>> I did a mistake - I'm getting not ClassNotFoundException but
>> ClassCastException:
>> java.lang.ClassCastException: org.apache.openjpa.find.entities.Document
>> cannot be cast to org.apache.openjpa.find.entities.Person
>> at org.apache.openjpa.find.FindTest.testFind(FindTest.java:54)
>>
>> It's a result of executing
>> final Person p = em.find(Person.class, doc.getId());
>>
>> All this can be found/reproduced in the project attached to the previous
>> post.
>>
>> Oleg
>>
>>
>> Rick Curtis wrote
>> > Can we see the exception?
>> >
>> > Thanks,
>> > Rick
>> >
>> > On Wed, Sep 10, 2014 at 9:26 AM, olyalikov <
>>
>> > oleg.lyalikov@
>>
>> > > wrote:
>> >
>> >> Hello,
>> >>
>> >> I have base entity and 2 inheritors e.g. Person and Document.
>> >> If I try to find Person entity and provide id of the Document entity I
>> >> get
>> >> ClassNotFoundException but it should return either null or
>> >> EntityNotFoundException.
>> >> If I provide just some wrong non existing id I get null.
>> >> Here is link to the maven project with test: openjpa-find-test.zip
>> >> <
>> http://openjpa.208410.n2.nabble.com/file/n7587085/openjpa-find-test.zip>
>> ;
>> >> Should I post a bug in issue tracker?
>> >>
>> >> Thanks,
>> >> Oleg
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
>> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> > --
>> > *Rick Curtis*
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085p7587090.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> *Rick Curtis*
--
View this message in context: http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085p7587095.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: EntityManager.find ClassCastException for wrong but existing id
Posted by Rick Curtis <cu...@gmail.com>.
I looked at your test, and it looks like an OpenJPA bug. I'd suggest
opening a JIRA[1] and attach your test case.
Thanks,
Rick
[1] https://issues.apache.org/jira/browse/OPENJPA
On Thu, Sep 11, 2014 at 2:38 AM, olyalikov <oleg.lyalikov@alcatel-lucent.com
> wrote:
> I did a mistake - I'm getting not ClassNotFoundException but
> ClassCastException:
> java.lang.ClassCastException: org.apache.openjpa.find.entities.Document
> cannot be cast to org.apache.openjpa.find.entities.Person
> at org.apache.openjpa.find.FindTest.testFind(FindTest.java:54)
>
> It's a result of executing
> final Person p = em.find(Person.class, doc.getId());
>
> All this can be found/reproduced in the project attached to the previous
> post.
>
> Oleg
>
>
> Rick Curtis wrote
> > Can we see the exception?
> >
> > Thanks,
> > Rick
> >
> > On Wed, Sep 10, 2014 at 9:26 AM, olyalikov <
>
> > oleg.lyalikov@
>
> > > wrote:
> >
> >> Hello,
> >>
> >> I have base entity and 2 inheritors e.g. Person and Document.
> >> If I try to find Person entity and provide id of the Document entity I
> >> get
> >> ClassNotFoundException but it should return either null or
> >> EntityNotFoundException.
> >> If I provide just some wrong non existing id I get null.
> >> Here is link to the maven project with test: openjpa-find-test.zip
> >> <
> http://openjpa.208410.n2.nabble.com/file/n7587085/openjpa-find-test.zip>
> ;
> >> Should I post a bug in issue tracker?
> >>
> >> Thanks,
> >> Oleg
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>
> >
> >
> >
> > --
> > *Rick Curtis*
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085p7587090.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
--
*Rick Curtis*
Re: EntityManager.find ClassCastException for wrong but existing id
Posted by olyalikov <ol...@alcatel-lucent.com>.
I did a mistake - I'm getting not ClassNotFoundException but
ClassCastException:
java.lang.ClassCastException: org.apache.openjpa.find.entities.Document
cannot be cast to org.apache.openjpa.find.entities.Person
at org.apache.openjpa.find.FindTest.testFind(FindTest.java:54)
It's a result of executing
final Person p = em.find(Person.class, doc.getId());
All this can be found/reproduced in the project attached to the previous
post.
Oleg
Rick Curtis wrote
> Can we see the exception?
>
> Thanks,
> Rick
>
> On Wed, Sep 10, 2014 at 9:26 AM, olyalikov <
> oleg.lyalikov@
> > wrote:
>
>> Hello,
>>
>> I have base entity and 2 inheritors e.g. Person and Document.
>> If I try to find Person entity and provide id of the Document entity I
>> get
>> ClassNotFoundException but it should return either null or
>> EntityNotFoundException.
>> If I provide just some wrong non existing id I get null.
>> Here is link to the maven project with test: openjpa-find-test.zip
>> <http://openjpa.208410.n2.nabble.com/file/n7587085/openjpa-find-test.zip>
>> Should I post a bug in issue tracker?
>>
>> Thanks,
>> Oleg
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> *Rick Curtis*
--
View this message in context: http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085p7587090.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: EntityManager.find ClassCastException for wrong but existing id
Posted by Rick Curtis <cu...@gmail.com>.
Can we see the exception?
Thanks,
Rick
On Wed, Sep 10, 2014 at 9:26 AM, olyalikov <oleg.lyalikov@alcatel-lucent.com
> wrote:
> Hello,
>
> I have base entity and 2 inheritors e.g. Person and Document.
> If I try to find Person entity and provide id of the Document entity I get
> ClassNotFoundException but it should return either null or
> EntityNotFoundException.
> If I provide just some wrong non existing id I get null.
> Here is link to the maven project with test: openjpa-find-test.zip
> <http://openjpa.208410.n2.nabble.com/file/n7587085/openjpa-find-test.zip>
> Should I post a bug in issue tracker?
>
> Thanks,
> Oleg
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
--
*Rick Curtis*