|
Re: Teneo Persists and Retrieves superclass not subclass. [message #1219051 is a reply to message #1219041] |
Sat, 30 November 2013 11:56 |
Martin Taal 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 #1219275 is a reply to message #1219069] |
Tue, 03 December 2013 05:48 |
Chandre Gowda 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 |
Martin Taal 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04977 seconds