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 #591229] Mon, 18 September 2006 09:13
daniel is currently offline danielFriend
Messages: 17
Registered: July 2009
Junior Member
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
Previous Topic:OCL help needed
Next Topic:wrong derived class returned by a get on a baseclass
Goto Forum:
  


Current Time: Thu Apr 25 06:32:40 GMT 2024

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

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

Back to the top