| Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » wrong derived class returned by a get on a baseclass
 Goto Forum:| 
| wrong derived class returned by a get on a baseclass [message #50767] | Mon, 18 September 2006 05:13  |  | 
| Eclipse User  |  |  |  |  | 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 08:00  |  | 
| Eclipse User  |  |  |  |  | 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 08:00  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 04:02:59 EDT 2025 
 Powered by FUDForum . Page generated in 0.04124 seconds |