Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo Persists and Retrieves superclass not subclass.(Teneo Persists and Retrieves superclass not subclass.)
Teneo Persists and Retrieves superclass not subclass. [message #1219041] Sat, 30 November 2013 03:38 Go to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
I have class A which has reference to another class B which has inheritance hierarchy i..e class B has sub class C. when I try to persist class A using TENEO framework which contains subclass C, the table stores class B name and not sub class C. when I load class A from database,which references to class B and not class C. Do I need to set any options to persist and load subclass.

Thanks
Chandru
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219051 is a reply to message #1219041] Sat, 30 November 2013 11:56 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
This should work fine, it is one of the basefeatures of an ORM/teneo. Is there a table for C, is C also being mapped?
Can you check the generated hbm?
Or it could be some multi-inheritance thing, so C inherits from B but C also inherits from something else which is
listed first in the esupertypes. or B has been set as a mappedsuperclass.

gr. Martin

On 11/30/2013 04:38 AM, Chandre Gowda wrote:
> I have class A which has reference to another class B which has inheritance hierarchy i..e class B has sub class C. when
> I try to persist class A using TENEO framework which contains subclass C, the table stores class B name and not sub
> class C. when I load class A from database,which references to class B and not class C. Do I need to set any options to
> persist and load subclass.
>
> Thanks
> Chandru


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219064 is a reply to message #1219051] Sat, 30 November 2013 17:32 Go to previous messageGo to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Thanks Martin for the reply.
There is no table for C. But we have table for D which is a superclass of B. B is stored in D's table but C is not stored in any of the table including table for D. C inherits only from B. In addition to this C has its own interface. Similarly B has its own interface. So C extends BImpl implements CInterface. Iam not sure this could be an issue.
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219069 is a reply to message #1219064] Sat, 30 November 2013 22:44 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
The only thing I can think of is that C is not mapped somehow, maybe it is abstract? Can you send me
(mtaal_at_elver.org) or post the corresponding generated hbm?

gr. Martin

On 11/30/2013 06:32 PM, Chandre Gowda wrote:
> Thanks Martin for the reply.
> There is no table for C. But we have table for D which is a superclass of B. B is stored in D's table but C is not
> stored in any of the table including table for D. C inherits only from B. In addition to this C has its own interface.
> Similarly B has its own interface. So C extends BImpl implements CInterface. Iam not sure this could be an issue.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219275 is a reply to message #1219069] Tue, 03 December 2013 05:48 Go to previous messageGo to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Sorry, There was a cyclic dependency in bundle which contains c, because of which it wasn't built. So the C's package wasn't initialized.
But iam getting different problem now.
We have separate ecore bundles for A, B, C, D. C model is referring to model B(Super class) and D. B is referring to D.
When i pass the B,C,D's packages to Datastore and when it executes datastore.initialze,
iam getting following error.

java.lang.IllegalArgumentException: EClass org.eclipse.emf.ecore.impl.EClassImpl@bd98b2 (name: null) (instanceClassName: null) (abstract: false, interface: false) has a null name.This can occur if epackages which refer to eachother are placed in different ecore/xsd files and they are not read using one resource set. The reference from one epackage to another must be resolvable by EMF.
at org.eclipse.emf.teneo.mapping.strategy.impl.ClassicEntityNameStrategy.toEntityName(ClassicEntityNameStrategy.java:71)

But only C is referring to B and not vice versa. Please let me know what else could be the issue.

Thanks
Chandru
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219302 is a reply to message #1219275] Tue, 03 December 2013 08:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
It seems that some reference of some eclass is not resolvable by EMF. The best thing is to check the epackages you pass
on to the datastore, so check if are indeed all the ereferences of all the eclasses are resolved correctly when you
access/traverse them.

Something like this:
for (EPackage ePackage: ePackages) {
for (EClassifier eClassifier: ePackage.getEClassifiers()) {
if (!(eClassifier instanceof EClass) {
continue;
}
EClass eClass = (EClass)eClassifier;
for (EReference eReference : eClass.getEAllReferences()) {
System.err.println(eReference.getEReferenceType().getName()); <--- this should not give null
}
}
}

gr. Martin

On 12/03/2013 06:48 AM, Chandre Gowda wrote:
> Sorry, There was a cyclic dependency in bundle which contains c, because of which it wasn't built. So the C's package
> wasn't initialized.
> But iam getting different problem now.
> We have separate ecore bundles for A, B, C, D. C model is referring to model B(Super class) and D. B is referring to D.
> When i pass the B,C,D's packages to Datastore and when it executes datastore.initialze,
> iam getting following error.
>
> java.lang.IllegalArgumentException: EClass mailto:org.eclipse.emf.ecore.impl.EClassImpl@bd98b2 (name: null)
> (instanceClassName: null) (abstract: false, interface: false) has a null name.This can occur if epackages which refer to
> eachother are placed in different ecore/xsd files and they are not read using one resource set. The reference from one
> epackage to another must be resolvable by EMF.
> at org.eclipse.emf.teneo.mapping.strategy.impl.ClassicEntityNameStrategy.toEntityName(ClassicEntityNameStrategy.java:71)
>
> But only C is referring to B and not vice versa. Please let me know what else could be the issue.
>
> Thanks
> Chandru


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219477 is a reply to message #1219302] Wed, 04 December 2013 05:52 Go to previous message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Thanks Martin. There was property in class C which we had deleted from other places but not from factory. I have regenerated the classes from ecore now and its working Smile

Thanks
Cahndru
Previous Topic:Compile errors with EEF code from XSD generated EMF model
Next Topic:Annotate Ecore Model with Hibernate-Validator
Goto Forum:
  


Current Time: Sat Feb 27 11:01:39 GMT 2021

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

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

Back to the top