Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Is it possible to persist hybrid model using Teneo?
Is it possible to persist hybrid model using Teneo? [message #487842] Thu, 24 September 2009 14:37 Go to next message
Eclipse UserFriend
Originally posted by: lifesting.gmail.com

For example, A normal Java Class is defined as below:

Public class MyStore{
Book book;
}

Assume that Book is an EMF class, which is referenced by the JavaBean
class MyStore, how to save them all by Teneo?

Thanks a lot!
Re: Is it possible to persist hybrid model using Teneo? [message #487925 is a reply to message #487842] Thu, 24 September 2009 20:32 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
This should work but you have to extend the HbSessionDataStore/HbEntityDataStore class, override the mapModel method and
add your own classes/mapping files to the configuration. Something like this:
protected void mapModel() {
super.mapModel();

// and then add your own classes/mapping by getting the Configuration object
// by calling getHibernateConfiguration/getConfiguration

}

Btw, I think this is an interesting case to support so feel free to post any obstacles you encounter, then I can solve them.

Are you using hibernate annotations or hbm.xml for your non-EMF classes?

Last thing, support for Teneo is given on the main emf newsgroup which I added as cc.

gr. Martin

david by chan wrote:

> For example, A normal Java Class is defined as below:
>
> Public class MyStore{
> Book book;
> }
>
> Assume that Book is an EMF class, which is referenced by the JavaBean
> class MyStore, how to save them all by Teneo?
>
> Thanks a lot!


--

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: Is it possible to persist hybrid model using Teneo? [message #488279 is a reply to message #487925] Sun, 27 September 2009 11:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lifesting.gmail.com

Martin Taal wrote:
> Hi David,
> This should work but you have to extend the
> HbSessionDataStore/HbEntityDataStore class, override the mapModel method
> and add your own classes/mapping files to the configuration. Something
> like this:
> protected void mapModel() {
> super.mapModel();
>
> // and then add your own classes/mapping by getting the
> Configuration object
> // by calling getHibernateConfiguration/getConfiguration
>
> }
>
> Btw, I think this is an interesting case to support so feel free to post
> any obstacles you encounter, then I can solve them.
>
> Are you using hibernate annotations or hbm.xml for your non-EMF classes?
>
> Last thing, support for Teneo is given on the main emf newsgroup which I
> added as cc.
>
> gr. Martin
>
> david by chan wrote:
>
>> For example, A normal Java Class is defined as below:
>>
>> Public class MyStore{
>> Book book;
>> }
>>
>> Assume that Book is an EMF class, which is referenced by the JavaBean
>> class MyStore, how to save them all by Teneo?
>>
>> Thanks a lot!
>
>

Marten, so thanks for your reply! In general, I use hbm.xml as mapping
configuration, but I think that using hibernate annotations is more
suitable if the non-EMF classes is generated by Tool/Compiler.

What are the differences between annotations and *.hbm.xml files in Teneo?

Regards!
Re: Is it possible to persist hybrid model using Teneo? [message #488292 is a reply to message #488279] Sun, 27 September 2009 18:16 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
Teneo works with JPA annotations in the model and not in the generated code. Internally Teneo translates the annotations
to a hbm which is passed on to Hibernate.

I am not sure if you want to combine non-EMF code (with JPA code) with EMF code which uses Teneo. If so: the key is that
for Teneo/EMF you have to use the HbSessionDataStore/HbEntityDataStore which means that you have to use the
SessionFactory/EntityManagerFactory created by these classes. I think that you can add the JPA annotated classes to the
Configuration object (see the getConfiguration() methods in the DataStore classes). So then you can use one
EntityManager for both Teneo and the non-EMF classes.

gr. Martin

david by chan wrote:
> Martin Taal wrote:
>> Hi David,
>> This should work but you have to extend the
>> HbSessionDataStore/HbEntityDataStore class, override the mapModel
>> method and add your own classes/mapping files to the configuration.
>> Something like this:
>> protected void mapModel() {
>> super.mapModel();
>>
>> // and then add your own classes/mapping by getting the
>> Configuration object
>> // by calling getHibernateConfiguration/getConfiguration
>>
>> }
>> Btw, I think this is an interesting case to support so feel free to
>> post any obstacles you encounter, then I can solve them.
>>
>> Are you using hibernate annotations or hbm.xml for your non-EMF classes?
>>
>> Last thing, support for Teneo is given on the main emf newsgroup which
>> I added as cc.
>>
>> gr. Martin
>>
>> david by chan wrote:
>>
>>> For example, A normal Java Class is defined as below:
>>>
>>> Public class MyStore{
>>> Book book;
>>> }
>>>
>>> Assume that Book is an EMF class, which is referenced by the JavaBean
>>> class MyStore, how to save them all by Teneo?
>>>
>>> Thanks a lot!
>>
>>
>
> Marten, so thanks for your reply! In general, I use hbm.xml as mapping
> configuration, but I think that using hibernate annotations is more
> suitable if the non-EMF classes is generated by Tool/Compiler.
>
> What are the differences between annotations and *.hbm.xml files in Teneo?
>
> Regards!


--

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: Is it possible to persist hybrid model using Teneo? [message #621394 is a reply to message #487842] Thu, 24 September 2009 20:32 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
This should work but you have to extend the HbSessionDataStore/HbEntityDataStore class, override the mapModel method and
add your own classes/mapping files to the configuration. Something like this:
protected void mapModel() {
super.mapModel();

// and then add your own classes/mapping by getting the Configuration object
// by calling getHibernateConfiguration/getConfiguration

}

Btw, I think this is an interesting case to support so feel free to post any obstacles you encounter, then I can solve them.

Are you using hibernate annotations or hbm.xml for your non-EMF classes?

Last thing, support for Teneo is given on the main emf newsgroup which I added as cc.

gr. Martin

david by chan wrote:

> For example, A normal Java Class is defined as below:
>
> Public class MyStore{
> Book book;
> }
>
> Assume that Book is an EMF class, which is referenced by the JavaBean
> class MyStore, how to save them all by Teneo?
>
> Thanks a lot!


--

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: Is it possible to persist hybrid model using Teneo? [message #621405 is a reply to message #487925] Sun, 27 September 2009 11:49 Go to previous message
Eclipse UserFriend
Originally posted by: lifesting.gmail.com

Martin Taal wrote:
> Hi David,
> This should work but you have to extend the
> HbSessionDataStore/HbEntityDataStore class, override the mapModel method
> and add your own classes/mapping files to the configuration. Something
> like this:
> protected void mapModel() {
> super.mapModel();
>
> // and then add your own classes/mapping by getting the
> Configuration object
> // by calling getHibernateConfiguration/getConfiguration
>
> }
>
> Btw, I think this is an interesting case to support so feel free to post
> any obstacles you encounter, then I can solve them.
>
> Are you using hibernate annotations or hbm.xml for your non-EMF classes?
>
> Last thing, support for Teneo is given on the main emf newsgroup which I
> added as cc.
>
> gr. Martin
>
> david by chan wrote:
>
>> For example, A normal Java Class is defined as below:
>>
>> Public class MyStore{
>> Book book;
>> }
>>
>> Assume that Book is an EMF class, which is referenced by the JavaBean
>> class MyStore, how to save them all by Teneo?
>>
>> Thanks a lot!
>
>

Marten, so thanks for your reply! In general, I use hbm.xml as mapping
configuration, but I think that using hibernate annotations is more
suitable if the non-EMF classes is generated by Tool/Compiler.

What are the differences between annotations and *.hbm.xml files in Teneo?

Regards!
Re: Is it possible to persist hybrid model using Teneo? [message #621406 is a reply to message #488279] Sun, 27 September 2009 18:16 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi David,
Teneo works with JPA annotations in the model and not in the generated code. Internally Teneo translates the annotations
to a hbm which is passed on to Hibernate.

I am not sure if you want to combine non-EMF code (with JPA code) with EMF code which uses Teneo. If so: the key is that
for Teneo/EMF you have to use the HbSessionDataStore/HbEntityDataStore which means that you have to use the
SessionFactory/EntityManagerFactory created by these classes. I think that you can add the JPA annotated classes to the
Configuration object (see the getConfiguration() methods in the DataStore classes). So then you can use one
EntityManager for both Teneo and the non-EMF classes.

gr. Martin

david by chan wrote:
> Martin Taal wrote:
>> Hi David,
>> This should work but you have to extend the
>> HbSessionDataStore/HbEntityDataStore class, override the mapModel
>> method and add your own classes/mapping files to the configuration.
>> Something like this:
>> protected void mapModel() {
>> super.mapModel();
>>
>> // and then add your own classes/mapping by getting the
>> Configuration object
>> // by calling getHibernateConfiguration/getConfiguration
>>
>> }
>> Btw, I think this is an interesting case to support so feel free to
>> post any obstacles you encounter, then I can solve them.
>>
>> Are you using hibernate annotations or hbm.xml for your non-EMF classes?
>>
>> Last thing, support for Teneo is given on the main emf newsgroup which
>> I added as cc.
>>
>> gr. Martin
>>
>> david by chan wrote:
>>
>>> For example, A normal Java Class is defined as below:
>>>
>>> Public class MyStore{
>>> Book book;
>>> }
>>>
>>> Assume that Book is an EMF class, which is referenced by the JavaBean
>>> class MyStore, how to save them all by Teneo?
>>>
>>> Thanks a lot!
>>
>>
>
> Marten, so thanks for your reply! In general, I use hbm.xml as mapping
> configuration, but I think that using hibernate annotations is more
> suitable if the non-EMF classes is generated by Tool/Compiler.
>
> What are the differences between annotations and *.hbm.xml files in Teneo?
>
> Regards!


--

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
Previous Topic:Generated editor and XSD syntax
Next Topic:[MWE] I cannot use my own extension for workflow files?
Goto Forum:
  


Current Time: Tue Apr 23 13:45:08 GMT 2024

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

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

Back to the top