Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [Teneo] How to store an existing model from XMI to MySQL database(About basic funcionallity and concepts of teneo.)
[Teneo] How to store an existing model from XMI to MySQL database [message #758530] |
Wed, 23 November 2011 15:23 |
CarlosM Messages: 5 Registered: November 2011 |
Junior Member |
|
|
Hi.
I would like to store some models that I have built according to my ecore metamodel to a MySQL database.
I have downloaded and installed Teneo and its dependencies, and I have seen how Teneo may be used to persist the information. However, the examples I have seen, build some objects according to the metamodel, and then persist de information in the database using Teneo within a session transaction or something like that.
What I would like to do, is to persist an existing model directly, not to create the objects programatically and at the end, persist the session. When I say "persist an existing model" I mean "to create the DDL in the database and afterwards, populate the data on that DDL". What I don't know is whether is there any procedure inside teneo that allows the editor to save the whole model without visiting the nodes of the tree...
Could you please tell me wether that is possible or not?
Otherwise, do I need to visit all the nodes of my tree model and persist the object for each one?
Have you got any other suggestion?
Thank you very much in advance.
Best regards.
Carlos.
|
|
|
Re: [Teneo] How to store an existing model from XMI to MySQL database [message #758541 is a reply to message #758530] |
Wed, 23 November 2011 15:44 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Carlos,
The datastore has an importDataStore method. You can try that.Or create a hibernateResource load from an input stream
and then save the resource.'
If you want to insert always then this should work fine. If you are updating then sometimes it makes sense to be more
precise, so reading objects from the database and then apply the data from the xml.
If you work server side only, so no rcp then the following project might be interesting to:
http://wiki.eclipse.org/Texo
It provides many of the same server side functionality as EMF but gives easier/simpler code which can be persisted in
any standard ORM without a runtime layer.
gr. Martin
On 11/23/2011 04:23 PM, CarlosM wrote:
> Hi.
>
> I would like to store some models that I have built according to my ecore metamodel to a MySQL database.
> I have downloaded and installed Teneo and its dependencies, and I have seen how Teneo may be used to persist the
> information. However, the examples I have seen, build some objects according to the metamodel, and then persist de
> information in the database using Teneo within a session transaction or something like that.
> What I would like to do, is to persist an existing model directly, not to create the objects programatically and at the
> end, persist the session. When I say "persist an existing model" I mean "to create the DDL in the database and
> afterwards, populate the data on that DDL". What I don't know is whether is there any procedure inside teneo that allows
> the editor to save the whole model without visiting the nodes of the tree...
> Could you please tell me wether that is possible or not?
> Otherwise, do I need to visit all the nodes of my tree model and persist the object for each one?
> Have you got any other suggestion?
>
> Thank you very much in advance.
> Best regards.
> Carlos.
--
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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: [Teneo] How to store an existing model from XMI to MySQL database [message #758919 is a reply to message #758916] |
Fri, 25 November 2011 09:31 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Is feature xxx a containment reference? If so you have to explicitly set its properties to resolve proxies. Also if
multiple resources should be saved together then they should use one session:
http://wiki.eclipse.org/Teneo/Hibernate/EMF_Resource#Sharing_one_Session_between_Resources.2C_One_transaction_when_saving_multiple_resources
gr. Martin
On 11/25/2011 10:17 AM, CarlosM wrote:
> Hi Martin.
>
> I have been doing some tests and it works fine.
> However, I have concerns about the cross references among distinct resources, at the time they're going to be persisted.
>
> When I say "cross reference" I mean one object in one particular resource which references other object in other
> resource. The second one is placed in only one resource but it may be referenced by other locations...
>
> I'm using for each object of my model an universal UUID stored in the XMI ID attribute.
> I have just tried to save first the resource where the referenced entity is, and then the resource where the entity
> which references to, is.
>
> I get in the log something like this:
> The feature 'xxx' of mailto:'org.xxx.impl.Entity@20e54a{.dbName#Entyty|id=_HY5j0Ba4EeGQTJDX4_KHmg}' contains an
> unresolved proxy mailto:'org.xxx.ReferencedEntity@1ad637e{theother.entity#_8NL5cBa3EeGQTJDX4_KHmg}'
>
> I would like to know how to resolve this kind of references if possible... because my model resources are very
> interconnnected in this way.
>
> Have voy got any suggestion?
>
> Thank you very much in advance, one again.
> Kind regards.
> Carlos.
--
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@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| | | |
Goto Forum:
Current Time: Sat Sep 21 01:48:06 GMT 2024
Powered by FUDForum. Page generated in 0.04580 seconds
|