Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Ecore model inheritance [solved](Adding Subclass to List<Superclass> seems to be non-persistent)
[CDO] Ecore model inheritance [solved] [message #1598987] Tue, 03 February 2015 09:48 Go to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Let's say we have got an object of type X, created from an ecore model, which is passed to CDO. This object holds a reference to other objects of type A. This works fine:

X x = XFactory.eINSTANCE.createX();
A a = AFactory.eINSTANCE.createA();
x.getA().add(a);


Now to my problem:
I am creating a new Ecore model B which extends A.
I can add this object B to the object X:

B b = BFactory.eINSTANCE.createB();
b.setSpecial("bla");
x.getA().add(b);


This does not produce any error, but the following will always return null after it was committed to CDO. What could I be doing wrong?

A a = x.getA().get(0);
if(a instanceof B) {
    System.out.println(((B) a).getSpecial());
}


Thank you for any advice!

[Updated on: Tue, 03 February 2015 13:24]

Report message to a moderator

Re: [CDO] Ecore model inheritance [message #1599127 is a reply to message #1598987] Tue, 03 February 2015 11:51 Go to previous message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Okay, of course it works fine. My mistake was to not prepare the ecore model for CDO.
Previous Topic:Migrate Model to updated Metamodel with Java
Next Topic:cannot add in watch points and duplicate task icons
Goto Forum:
  


Current Time: Tue Apr 16 12:51:12 GMT 2024

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

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

Back to the top