Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » wrong derived class returned by a get on a baseclass
wrong derived class returned by a get on a baseclass [message #50767] Mon, 18 September 2006 09:13 Go to next message
Eclipse UserFriend
Originally posted by: daniel_bret.yahoo.fr

hi Martin

I am trying the teneo plugin v : _0.7.5.v200609141628
(still eclipse 3.2, WTP 1.5, Java5..)

I get problem with the returned class by a get on a base class reference
field from database, something like :
relation : ClassA(1--01)BaseClassB and ChildClassC and ChildClassD derived
from BaseClassB
then creation of objects : a1 (ClassA)--c3(ChildClassC) and
a2(ClassA)--d4(ChildClassD)
the get method fail with an error message from the Eclipse debugger :
"com.sun.jdi.InvocationException occurred invoking method" (invocation by
lazyLoading when the get ?)
and then
FetchRequest.execute
Exception in thread "main" javax.jdo.JDOObjectNotFoundException: No such
database row
FailedObject:XXX(because wrong class then wrong table fetched)
at org.jpox.store.rdbms.request.FetchRequest.execute(FetchReque st.java:193)
at org.jpox.store.rdbms.table.ClassTable.fetch(ClassTable.java: 2412)
at org.jpox.store.StoreManager.fetch(StoreManager.java:796)
at
org.jpox.state.StateManagerImpl.loadNonDFGFields(StateManage rImpl.java:1702)
at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1949)
.....etc.

i built a small sample to reproduce the thing
something like :
a class A has a relation (linkedObject) to a baseClass BaseB
ChildC, ChildD...are derived from BaseB
(see UML model sample)

after EMF generation, jdo file generation with teneo, enhancement (jpox
1.1.1), link to a postgresql database (with a sequence and
"identity-type="application")...
(see jdo file)

using a class like your tutorial class (see the init class)
I build some objects from class A : a1, a2
and some other ones from classes ChildC, ChildD : c3, d4
and link objects like this :
object a1 from class A on c3 from ChildC class (so a1.getLinkedObject()
should give c3 as ChildC class)
object a2 from class A on d4 from ChildD class (so a2.getLinkedObject()
should give d4 as ChildD class)

it is well built and well stored in the database in the right classes (c3 in
table for ChildC class, d4 in table for class ChildD with foreign keys on
table for BaseB and relations fk are ok)

but with a request on the database
a1 and a2 are well retrieved
but the getlinkedObject() give me the right object ids but from a wrong
class :
a1.getLinkedObject().getId() is good but ...getClass() is A class instead of
ChildC
a2.getLinkedObject().getId() is good but ...getClass() is A class instead of
ChildD
(see runTrace picture)
you may reproduce that

(something else : the inheritance in the jdo file (implements all base
classes intefaces) don't appear like before, so the inheritance is seen
where by JDO ?)

so is that a bug ?
is that wrong code myside ? with inheritance handling... ? bad use of java5
generics

thanks
daniel

attached documents already sent by mail
Re: wrong derived class returned by a get on a baseclass [message #50795 is a reply to message #50767] Mon, 18 September 2006 12:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Daniel,
I have tested it and this seems like a jpox issue. I have tested this with the latest nightly build
and it also goes wrong.
Can you post your issue testcase at the jpox forum?
You should also post the log file, in the log file you can see that jpox retrieves an object with id
11, in the database this object is a childobject2, however jpox identifies it as a childobject1.

If you post on the jpox forum then I will also watch it and answer questions if possible.

gr. Martin

daniel wrote:
> hi Martin
>
> I am trying the teneo plugin v : _0.7.5.v200609141628
> (still eclipse 3.2, WTP 1.5, Java5..)
>
> I get problem with the returned class by a get on a base class reference
> field from database, something like :
> relation : ClassA(1--01)BaseClassB and ChildClassC and ChildClassD derived
> from BaseClassB
> then creation of objects : a1 (ClassA)--c3(ChildClassC) and
> a2(ClassA)--d4(ChildClassD)
> the get method fail with an error message from the Eclipse debugger :
> "com.sun.jdi.InvocationException occurred invoking method" (invocation by
> lazyLoading when the get ?)
> and then
> FetchRequest.execute
> Exception in thread "main" javax.jdo.JDOObjectNotFoundException: No such
> database row
> FailedObject:XXX(because wrong class then wrong table fetched)
> at org.jpox.store.rdbms.request.FetchRequest.execute(FetchReque st.java:193)
> at org.jpox.store.rdbms.table.ClassTable.fetch(ClassTable.java: 2412)
> at org.jpox.store.StoreManager.fetch(StoreManager.java:796)
> at
> org.jpox.state.StateManagerImpl.loadNonDFGFields(StateManage rImpl.java:1702)
> at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1949)
> .....etc.
>
> i built a small sample to reproduce the thing
> something like :
> a class A has a relation (linkedObject) to a baseClass BaseB
> ChildC, ChildD...are derived from BaseB
> (see UML model sample)
>
> after EMF generation, jdo file generation with teneo, enhancement (jpox
> 1.1.1), link to a postgresql database (with a sequence and
> "identity-type="application")...
> (see jdo file)
>
> using a class like your tutorial class (see the init class)
> I build some objects from class A : a1, a2
> and some other ones from classes ChildC, ChildD : c3, d4
> and link objects like this :
> object a1 from class A on c3 from ChildC class (so a1.getLinkedObject()
> should give c3 as ChildC class)
> object a2 from class A on d4 from ChildD class (so a2.getLinkedObject()
> should give d4 as ChildD class)
>
> it is well built and well stored in the database in the right classes (c3 in
> table for ChildC class, d4 in table for class ChildD with foreign keys on
> table for BaseB and relations fk are ok)
>
> but with a request on the database
> a1 and a2 are well retrieved
> but the getlinkedObject() give me the right object ids but from a wrong
> class :
> a1.getLinkedObject().getId() is good but ...getClass() is A class instead of
> ChildC
> a2.getLinkedObject().getId() is good but ...getClass() is A class instead of
> ChildD
> (see runTrace picture)
> you may reproduce that
>
> (something else : the inheritance in the jdo file (implements all base
> classes intefaces) don't appear like before, so the inheritance is seen
> where by JDO ?)
>
> so is that a bug ?
> is that wrong code myside ? with inheritance handling... ? bad use of java5
> generics
>
> thanks
> daniel
>
> attached documents already sent by mail
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: wrong derived class returned by a get on a baseclass [message #591242 is a reply to message #50767] Mon, 18 September 2006 12:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Daniel,
I have tested it and this seems like a jpox issue. I have tested this with the latest nightly build
and it also goes wrong.
Can you post your issue testcase at the jpox forum?
You should also post the log file, in the log file you can see that jpox retrieves an object with id
11, in the database this object is a childobject2, however jpox identifies it as a childobject1.

If you post on the jpox forum then I will also watch it and answer questions if possible.

gr. Martin

daniel wrote:
> hi Martin
>
> I am trying the teneo plugin v : _0.7.5.v200609141628
> (still eclipse 3.2, WTP 1.5, Java5..)
>
> I get problem with the returned class by a get on a base class reference
> field from database, something like :
> relation : ClassA(1--01)BaseClassB and ChildClassC and ChildClassD derived
> from BaseClassB
> then creation of objects : a1 (ClassA)--c3(ChildClassC) and
> a2(ClassA)--d4(ChildClassD)
> the get method fail with an error message from the Eclipse debugger :
> "com.sun.jdi.InvocationException occurred invoking method" (invocation by
> lazyLoading when the get ?)
> and then
> FetchRequest.execute
> Exception in thread "main" javax.jdo.JDOObjectNotFoundException: No such
> database row
> FailedObject:XXX(because wrong class then wrong table fetched)
> at org.jpox.store.rdbms.request.FetchRequest.execute(FetchReque st.java:193)
> at org.jpox.store.rdbms.table.ClassTable.fetch(ClassTable.java: 2412)
> at org.jpox.store.StoreManager.fetch(StoreManager.java:796)
> at
> org.jpox.state.StateManagerImpl.loadNonDFGFields(StateManage rImpl.java:1702)
> at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1949)
> .....etc.
>
> i built a small sample to reproduce the thing
> something like :
> a class A has a relation (linkedObject) to a baseClass BaseB
> ChildC, ChildD...are derived from BaseB
> (see UML model sample)
>
> after EMF generation, jdo file generation with teneo, enhancement (jpox
> 1.1.1), link to a postgresql database (with a sequence and
> "identity-type="application")...
> (see jdo file)
>
> using a class like your tutorial class (see the init class)
> I build some objects from class A : a1, a2
> and some other ones from classes ChildC, ChildD : c3, d4
> and link objects like this :
> object a1 from class A on c3 from ChildC class (so a1.getLinkedObject()
> should give c3 as ChildC class)
> object a2 from class A on d4 from ChildD class (so a2.getLinkedObject()
> should give d4 as ChildD class)
>
> it is well built and well stored in the database in the right classes (c3 in
> table for ChildC class, d4 in table for class ChildD with foreign keys on
> table for BaseB and relations fk are ok)
>
> but with a request on the database
> a1 and a2 are well retrieved
> but the getlinkedObject() give me the right object ids but from a wrong
> class :
> a1.getLinkedObject().getId() is good but ...getClass() is A class instead of
> ChildC
> a2.getLinkedObject().getId() is good but ...getClass() is A class instead of
> ChildD
> (see runTrace picture)
> you may reproduce that
>
> (something else : the inheritance in the jdo file (implements all base
> classes intefaces) don't appear like before, so the inheritance is seen
> where by JDO ?)
>
> so is that a bug ?
> is that wrong code myside ? with inheritance handling... ? bad use of java5
> generics
>
> thanks
> daniel
>
> attached documents already sent by mail
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:wrong derived class returned by a get on a baseclass
Next Topic:Article: Implementing Model Integrity in EMF with EMFT OCL
Goto Forum:
  


Current Time: Fri Apr 26 14:41:18 GMT 2024

Powered by FUDForum. Page generated in 0.03925 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top