Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [solved][Teneo] Persistence mapping builder looking for everything
icon14.gif  [solved][Teneo] Persistence mapping builder looking for everything [message #1720440] Mon, 18 January 2016 16:16 Go to next message
Pierre Villard is currently offline Pierre VillardFriend
Messages: 9
Registered: July 2013
Junior Member
Hi,

I am quite new using Teneo and I am facing an issue with my model.

Version of EMF Ecore : 2.11.1
Version of Teneo : 2.1.0
Version of Hibernate : 4.3.11

I have a model based on quite complex XSD files that I can't modify. The generation of the model is fine.
I am trying to test Teneo with a persistence file that is only referencing one class :

<persistence-mapping>
	<epackage namespace-uri="http://a/b/c/">
		<eclass name="MyObject">
			<entity />
		</eclass>
	</epackage>
</persistence-mapping>


The class MyObject is only referencing simple types.
So I would expect that the Teneo mapping is working fine as is.

However, as far as I understand what is going on, the mapping builder is looking for dependencies of the EPackage containing MyObject (and there is a lot of EPackage dependencies).

To get things going further I need to register with Teneo the other EPackages. Is it mandatory ? Or is there a way to only look for what is needed according to my persistence file ?

If I don't register the other EPackages, I get the following error :

Caused by: java.lang.IllegalArgumentException: No annotated model element present  for: Foo for type EClass has its epackage been registered with Teneo?
	at org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedModelImpl.checkAnnotatedPresent(PAnnotatedModelImpl.java:347) ~[org.eclipse.emf.teneo.annotations-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedModelImpl.getPAnnotated(PAnnotatedModelImpl.java:287) ~[org.eclipse.emf.teneo.annotations-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedEReferenceImpl.getAReferenceType(PAnnotatedEReferenceImpl.java:227) ~[org.eclipse.emf.teneo.annotations-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator.annotate(EFeatureAnnotator.java:111) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:307) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


If it is mandatory, my other problem is that, in my model, some objects have attributes of type "AnyType" and it seems to be a problem with Teneo. It makes sense that this is a problem because I don't see how it would be possible to handle "AnyType" objects in a database.

If I add all the required EPackages, I get the following error :

Caused by: java.lang.IllegalArgumentException: No annotated model element present  for: AnyType for type EClass has its epackage been registered with Teneo?
	at org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedModelImpl.checkAnnotatedPresent(PAnnotatedModelImpl.java:347) ~[org.eclipse.emf.teneo.annotations-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.pamodel.impl.PAnnotatedModelImpl.getPAnnotated(PAnnotatedModelImpl.java:287) ~[org.eclipse.emf.teneo.annotations-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:96) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


So I tried to add the following EPackage :

org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl


But in this case, I get the following error :

Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.teneo.annotations.mapper.ManyToOneReferenceAnnotator.annotate(ManyToOneReferenceAnnotator.java:105) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbManyToOneReferenceAnnotator.annotate(HbManyToOneReferenceAnnotator.java:48) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator.annotate(EFeatureAnnotator.java:236) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:307) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


Am I missing something ?


EDIT :

Well.. I tried to remove all the AnyType declaration and the reference to the generic package (org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl) and I still get the last error I reported in my previous post :


Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.teneo.annotations.mapper.ManyToOneReferenceAnnotator.annotate(ManyToOneReferenceAnnotator.java:105) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbManyToOneReferenceAnnotator.annotate(HbManyToOneReferenceAnnotator.java:48) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator.annotate(EFeatureAnnotator.java:236) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:307) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


Any idea how to debug this issue ?

Thanks a lot for your help !

[Updated on: Tue, 19 January 2016 08:43]

Report message to a moderator

Re: [Teneo] Persistence mapping builder looking for everything [message #1720442 is a reply to message #1720440] Mon, 18 January 2016 16:23 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Piere,
You are not missing anything (that's the good news Smile

Indeed Teneo will map the whole content of an epackage, the persistence file does not limit what get's mapped. You can make eclasses/eattributes/ereferences transient though. The transient model elements are ignored. So if there are not too many and you don't need to persist the anytypes you can make these ereferences transient one by one. You do this by setting an annotation on the ereference/eattribute:
https://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Annotations_Support#Transient_on_EClass
https://wiki.eclipse.org/Teneo/Hibernate/ModelRelational

gr. Martin
Re: [Teneo] Persistence mapping builder looking for everything [message #1720446 is a reply to message #1720440] Mon, 18 January 2016 16:47 Go to previous messageGo to next message
Pierre Villard is currently offline Pierre VillardFriend
Messages: 9
Registered: July 2013
Junior Member
I removed all the "AnyType" declarations in my XSDs (and the reference to the org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl package) and I still get the last error given in my initial post :

Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.teneo.annotations.mapper.ManyToOneReferenceAnnotator.annotate(ManyToOneReferenceAnnotator.java:105) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbManyToOneReferenceAnnotator.annotate(HbManyToOneReferenceAnnotator.java:48) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator.annotate(EFeatureAnnotator.java:236) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:307) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


Any suggestion to debug this issue ?
Re: [Teneo] Persistence mapping builder looking for everything [message #1720447 is a reply to message #1720440] Mon, 18 January 2016 16:49 Go to previous messageGo to next message
Pierre Villard is currently offline Pierre VillardFriend
Messages: 9
Registered: July 2013
Junior Member
Well.. I tried to remove all the AnyType declaration and the reference to the generic package (org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl) and I still get the last error I reported in my previous post :

Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.teneo.annotations.mapper.ManyToOneReferenceAnnotator.annotate(ManyToOneReferenceAnnotator.java:105) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbManyToOneReferenceAnnotator.annotate(HbManyToOneReferenceAnnotator.java:48) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EFeatureAnnotator.annotate(EFeatureAnnotator.java:236) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.EClassAnnotator.annotate(EClassAnnotator.java:307) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.annotations.HbEClassAnnotator.annotate(HbEClassAnnotator.java:56) ~[org.eclipse.emf.teneo.hibernate.mapper-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.processPackage(AnnotationGenerator.java:183) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.AnnotationGenerator.map(AnnotationGenerator.java:146) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingBuilder.buildMapping(PersistenceMappingBuilder.java:215) ~[org.eclipse.emf.teneo-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbDataStore.java:1070) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.mapModel(HbEntityDataStore.java:241) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]
	at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) ~[org.eclipse.emf.teneo.hibernate-2.1.0-v201501071531.jar:na]


Any idea how to debug this issue ?
Re: [Teneo] Persistence mapping builder looking for everything [message #1720536 is a reply to message #1720447] Tue, 19 January 2016 08:41 Go to previous messageGo to next message
Pierre Villard is currently offline Pierre VillardFriend
Messages: 9
Registered: July 2013
Junior Member
Hi Martin,

Thanks for your help, I resolved my problems by removing the AnyType manually and solving some issues in the provided XSD files.
It is now working fine.
Re: [Teneo] Persistence mapping builder looking for everything [message #1720781 is a reply to message #1720536] Wed, 20 January 2016 22:45 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Great, it is a pity but I don't seem to get notified of replies to a post I already got notified for... I missed your follow up NPE posts, but good that it got solved!

gr. Martin
Previous Topic:[EMF Forms] Text field to property binding issue on Mac OSX / Cocoa
Next Topic:[ECP] Changing tree node labels - generic approach
Goto Forum:
  


Current Time: Thu Apr 18 01:56:12 GMT 2024

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

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

Back to the top