Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Saving an Ecore Miodel
[Teneo] Saving an Ecore Miodel [message #83862] Thu, 17 May 2007 19:50 Go to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

Martin,

I think I have found a way to improve my performance problems by
changing my model. I was trying to put a bunch of different data models
into 1 database (using a normalized form), however, it works much better
if I save the different data models in separate databases.

However, this approach requires me to save both my Ecore model and my
instance data using Teneo. The instance data saving works no problem,
however, when I save my Ecore model, the etype of my references and
attributes don't seem to get saved. This this a known issue?

All I am doing is setting my hdbs.setEPackages to
EcorePackage.eInstance, and then saving my package.

Do I have to do something different to save the etypes?

Thanks for all your help,
Ian
Re: [Teneo] Saving an Ecore Miodel [message #83891 is a reply to message #83862] Fri, 18 May 2007 04:17 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ian,
The cause could be that you maybe miss this epackage:
XMLTypePackage.eINSTANCE

You should pass both this xmltype epackage, the ecorepackage and your application model epackages to
the hbds.

gr. Martin

Ian Bull wrote:
> Martin,
>
> I think I have found a way to improve my performance problems by
> changing my model. I was trying to put a bunch of different data models
> into 1 database (using a normalized form), however, it works much better
> if I save the different data models in separate databases.
>
> However, this approach requires me to save both my Ecore model and my
> instance data using Teneo. The instance data saving works no problem,
> however, when I save my Ecore model, the etype of my references and
> attributes don't seem to get saved. This this a known issue?
>
> All I am doing is setting my hdbs.setEPackages to
> EcorePackage.eInstance, and then saving my package.
>
> Do I have to do something different to save the etypes?
>
> Thanks for all your help,
> Ian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Saving an Ecore Miodel [message #84096 is a reply to message #83891] Fri, 18 May 2007 20:33 Go to previous message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

You're right, I did miss the XMLTypePackage. However, it still seems to
be giving me some errors. I don't really understand why I need to pass
my application model as a package to the hbds. I am trying to save my
application model to the database, so therefore don't I just need to
pass the MetaModel for my application model (which is Ecore and
XMLTypePackage).

I tried to pass my application model package to hbds too, but that still
didn't work. My code is now just:

<code>

DatabaseCreate.setupTeneo(hbds, dbMetaModelName, new EPackage[] {
XMLTypePackage.eINSTANCE, EcorePackage.eINSTANCE });

Session session = hbds.getSessionFactory().openSession();
Transaction tx = session.getTransaction();
tx = session.getTransaction();
tx.begin();
session.save( <<THE EPACKAGE FOR MY MODEL>> );
tx.commit();
System.out.println("Finished saving meta-model");

</code>

Then when I load this back, I get the EPackage, then I set the epackage
in hbds and try and load the instance I get the following NPE:

Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.ERuntime.computeContainedClasses(ERunt ime.java:141)
at org.eclipse.emf.teneo.ERuntime.register(ERuntime.java:99)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:192)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:128)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
at viewrecommender.ecore.DatabaseCreate.setupTeneo(DatabaseCrea te.java:37)
at viewrecommender.ecore.DatabaseAccess.main(DatabaseAccess.jav a:107)

I looked at the mappings that were generated and it seems that the
TypedElement is not actually saving its type:

it is only saving its:
epackage,
ordered,
unique,
lowerBound
upperBound


Thanks again,
Ian

Martin Taal wrote:
> Ian,
> The cause could be that you maybe miss this epackage:
> XMLTypePackage.eINSTANCE
>
> You should pass both this xmltype epackage, the ecorepackage and your
> application model epackages to the hbds.
>
> gr. Martin
>
> Ian Bull wrote:
>> Martin,
>>
>> I think I have found a way to improve my performance problems by
>> changing my model. I was trying to put a bunch of different data
>> models into 1 database (using a normalized form), however, it works
>> much better if I save the different data models in separate databases.
>>
>> However, this approach requires me to save both my Ecore model and my
>> instance data using Teneo. The instance data saving works no problem,
>> however, when I save my Ecore model, the etype of my references and
>> attributes don't seem to get saved. This this a known issue?
>>
>> All I am doing is setting my hdbs.setEPackages to
>> EcorePackage.eInstance, and then saving my package.
>>
>> Do I have to do something different to save the etypes?
>>
>> Thanks for all your help,
>> Ian
>
>
Re: [Teneo] Saving an Ecore Miodel [message #606723 is a reply to message #83862] Fri, 18 May 2007 04:17 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ian,
The cause could be that you maybe miss this epackage:
XMLTypePackage.eINSTANCE

You should pass both this xmltype epackage, the ecorepackage and your application model epackages to
the hbds.

gr. Martin

Ian Bull wrote:
> Martin,
>
> I think I have found a way to improve my performance problems by
> changing my model. I was trying to put a bunch of different data models
> into 1 database (using a normalized form), however, it works much better
> if I save the different data models in separate databases.
>
> However, this approach requires me to save both my Ecore model and my
> instance data using Teneo. The instance data saving works no problem,
> however, when I save my Ecore model, the etype of my references and
> attributes don't seem to get saved. This this a known issue?
>
> All I am doing is setting my hdbs.setEPackages to
> EcorePackage.eInstance, and then saving my package.
>
> Do I have to do something different to save the etypes?
>
> Thanks for all your help,
> Ian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo] Saving an Ecore Miodel [message #606737 is a reply to message #83891] Fri, 18 May 2007 20:33 Go to previous message
Ian Bull is currently offline Ian BullFriend
Messages: 145
Registered: July 2009
Senior Member
You're right, I did miss the XMLTypePackage. However, it still seems to
be giving me some errors. I don't really understand why I need to pass
my application model as a package to the hbds. I am trying to save my
application model to the database, so therefore don't I just need to
pass the MetaModel for my application model (which is Ecore and
XMLTypePackage).

I tried to pass my application model package to hbds too, but that still
didn't work. My code is now just:

<code>

DatabaseCreate.setupTeneo(hbds, dbMetaModelName, new EPackage[] {
XMLTypePackage.eINSTANCE, EcorePackage.eINSTANCE });

Session session = hbds.getSessionFactory().openSession();
Transaction tx = session.getTransaction();
tx = session.getTransaction();
tx.begin();
session.save( <<THE EPACKAGE FOR MY MODEL>> );
tx.commit();
System.out.println("Finished saving meta-model");

</code>

Then when I load this back, I get the EPackage, then I set the epackage
in hbds and try and load the instance I get the following NPE:

Exception in thread "main" java.lang.NullPointerException
at
org.eclipse.emf.teneo.ERuntime.computeContainedClasses(ERunt ime.java:141)
at org.eclipse.emf.teneo.ERuntime.register(ERuntime.java:99)
at
org.eclipse.emf.teneo.annotations.mapper.DefaultAnnotator.ma p(DefaultAnnotator.java:192)
at
org.eclipse.emf.teneo.annotations.mapper.PersistenceMappingB uilder.buildMapping(PersistenceMappingBuilder.java:128)
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
at viewrecommender.ecore.DatabaseCreate.setupTeneo(DatabaseCrea te.java:37)
at viewrecommender.ecore.DatabaseAccess.main(DatabaseAccess.jav a:107)

I looked at the mappings that were generated and it seems that the
TypedElement is not actually saving its type:

it is only saving its:
epackage,
ordered,
unique,
lowerBound
upperBound


Thanks again,
Ian

Martin Taal wrote:
> Ian,
> The cause could be that you maybe miss this epackage:
> XMLTypePackage.eINSTANCE
>
> You should pass both this xmltype epackage, the ecorepackage and your
> application model epackages to the hbds.
>
> gr. Martin
>
> Ian Bull wrote:
>> Martin,
>>
>> I think I have found a way to improve my performance problems by
>> changing my model. I was trying to put a bunch of different data
>> models into 1 database (using a normalized form), however, it works
>> much better if I save the different data models in separate databases.
>>
>> However, this approach requires me to save both my Ecore model and my
>> instance data using Teneo. The instance data saving works no problem,
>> however, when I save my Ecore model, the etype of my references and
>> attributes don't seem to get saved. This this a known issue?
>>
>> All I am doing is setting my hdbs.setEPackages to
>> EcorePackage.eInstance, and then saving my package.
>>
>> Do I have to do something different to save the etypes?
>>
>> Thanks for all your help,
>> Ian
>
>
Previous Topic:[Teneo] eContainer has not been saved?
Next Topic:[Teneo] eContainer saving
Goto Forum:
  


Current Time: Tue Jan 19 22:44:40 GMT 2021

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

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

Back to the top