Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMF EObject with JPA
EMF EObject with JPA [message #1407776] Wed, 13 August 2014 12:28 Go to next message
Marina Knieling is currently offline Marina KnielingFriend
Messages: 83
Registered: February 2013
Member
Hey guys,

is it possible to annotate EObjects with JPA annotations? We're working
in a JBoss environment and need to use EJB and JPA but we'd like to make
use of the integrated undo/redo mechanism of the EMF EObjects. Using
Texo on the server side and EMF on the client side as described in this
thread (http://www.eclipse.org/forums/index.php/t/199296/) was my first
idea, but serializing/deserializing the model and sending it back and
forth is no real option (a similar approach has been discarded in our
company not so long ago).

So a colleague first had the idea to simply implement EObject but I
think EMF is more than just EObject (thinking of the Package and
Reflective API).

Are there any other ideas on this use case or can I just annotate my
EObjects with JPA annotations?

Thanks for any hints or ideas on that

Marina Knieling
Re: EMF EObject with JPA [message #1407884 is a reply to message #1407776] Wed, 13 August 2014 17:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Marina,
Directly annotating EObjects won't work because EMF has its own list implementations, often JPA solutions also have
their own list implementations which collide with what EMF does/needs.

Some options:
You can try the Teneo project but it only works with Hibernate. https://wiki.eclipse.org/Teneo
Texo can also be used directly in your webcontainer, so no need to go through json serialization afaics. But there is a
conversion from EObjects to Texo objects and back, it makes use of the EMF proxy concept so it is somewhat transparent
for the EMF-using-code.

gr. Martin

On 13-08-14 14:28, Marina Knieling wrote:
> Hey guys,
>
> is it possible to annotate EObjects with JPA annotations? We're working in a JBoss environment and need to use EJB and
> JPA but we'd like to make use of the integrated undo/redo mechanism of the EMF EObjects. Using Texo on the server side
> and EMF on the client side as described in this thread (http://www.eclipse.org/forums/index.php/t/199296/) was my first
> idea, but serializing/deserializing the model and sending it back and forth is no real option (a similar approach has
> been discarded in our company not so long ago).
>
> So a colleague first had the idea to simply implement EObject but I think EMF is more than just EObject (thinking of the
> Package and Reflective API).
>
> Are there any other ideas on this use case or can I just annotate my EObjects with JPA annotations?
>
> Thanks for any hints or ideas on that
>
> Marina Knieling


--

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: EMF EObject with JPA [message #1408107 is a reply to message #1407884] Thu, 14 August 2014 08:41 Go to previous messageGo to next message
Marina Knieling is currently offline Marina KnielingFriend
Messages: 83
Registered: February 2013
Member
Hi Martin,

in our environment we're using Hibernate as the JPA implementation. I've
worked with Teneo before, but only for a small project and not in
combination with any application server and so I wasn't aware of the
possibility to annotate models with JPA annotations.

Does that mean that I can 'simply' create the ecore model, add
annotations for JPA via EAnnotations (e.g. specifying column names) and
then this is equal/similar to writing POJOs and annotating them
manually? With the only difference that I now have EObjects instead of
normal Objects?

That sounds like a solution to me.

Thanks, Marina

On 13.08.2014 19:53, Martin Taal wrote:
> Hi Marina,
> Directly annotating EObjects won't work because EMF has its own list
> implementations, often JPA solutions also have their own list
> implementations which collide with what EMF does/needs.
>
> Some options:
> You can try the Teneo project but it only works with Hibernate.
> https://wiki.eclipse.org/Teneo
> Texo can also be used directly in your webcontainer, so no need to go
> through json serialization afaics. But there is a conversion from
> EObjects to Texo objects and back, it makes use of the EMF proxy concept
> so it is somewhat transparent for the EMF-using-code.
>
> gr. Martin
>
> On 13-08-14 14:28, Marina Knieling wrote:
>> Hey guys,
>>
>> is it possible to annotate EObjects with JPA annotations? We're
>> working in a JBoss environment and need to use EJB and
>> JPA but we'd like to make use of the integrated undo/redo mechanism of
>> the EMF EObjects. Using Texo on the server side
>> and EMF on the client side as described in this thread
>> (http://www.eclipse.org/forums/index.php/t/199296/) was my first
>> idea, but serializing/deserializing the model and sending it back and
>> forth is no real option (a similar approach has
>> been discarded in our company not so long ago).
>>
>> So a colleague first had the idea to simply implement EObject but I
>> think EMF is more than just EObject (thinking of the
>> Package and Reflective API).
>>
>> Are there any other ideas on this use case or can I just annotate my
>> EObjects with JPA annotations?
>>
>> Thanks for any hints or ideas on that
>>
>> Marina Knieling
>
>
Re: EMF EObject with JPA [message #1408253 is a reply to message #1408107] Thu, 14 August 2014 15:46 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hey Marina,
Yes that's indeed how it works. Teneo only depends on a few of the EMF jars (and Hibernate):
https://wiki.eclipse.org/Teneo/Hibernate/Download_and_Install#Usage_in_a_Web_Container_-_Maven

gr. Martin

On 14-08-14 10:41, Marina Knieling wrote:
> Hi Martin,
>
> in our environment we're using Hibernate as the JPA implementation. I've worked with Teneo before, but only for a small
> project and not in combination with any application server and so I wasn't aware of the possibility to annotate models
> with JPA annotations.
>
> Does that mean that I can 'simply' create the ecore model, add annotations for JPA via EAnnotations (e.g. specifying
> column names) and then this is equal/similar to writing POJOs and annotating them manually? With the only difference
> that I now have EObjects instead of normal Objects?
>
> That sounds like a solution to me.
>
> Thanks, Marina
>
> On 13.08.2014 19:53, Martin Taal wrote:
>> Hi Marina,
>> Directly annotating EObjects won't work because EMF has its own list
>> implementations, often JPA solutions also have their own list
>> implementations which collide with what EMF does/needs.
>>
>> Some options:
>> You can try the Teneo project but it only works with Hibernate.
>> https://wiki.eclipse.org/Teneo
>> Texo can also be used directly in your webcontainer, so no need to go
>> through json serialization afaics. But there is a conversion from
>> EObjects to Texo objects and back, it makes use of the EMF proxy concept
>> so it is somewhat transparent for the EMF-using-code.
>>
>> gr. Martin
>>
>> On 13-08-14 14:28, Marina Knieling wrote:
>>> Hey guys,
>>>
>>> is it possible to annotate EObjects with JPA annotations? We're
>>> working in a JBoss environment and need to use EJB and
>>> JPA but we'd like to make use of the integrated undo/redo mechanism of
>>> the EMF EObjects. Using Texo on the server side
>>> and EMF on the client side as described in this thread
>>> (http://www.eclipse.org/forums/index.php/t/199296/) was my first
>>> idea, but serializing/deserializing the model and sending it back and
>>> forth is no real option (a similar approach has
>>> been discarded in our company not so long ago).
>>>
>>> So a colleague first had the idea to simply implement EObject but I
>>> think EMF is more than just EObject (thinking of the
>>> Package and Reflective API).
>>>
>>> Are there any other ideas on this use case or can I just annotate my
>>> EObjects with JPA annotations?
>>>
>>> Thanks for any hints or ideas on that
>>>
>>> Marina Knieling
>>
>>
>


--

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
Previous Topic:[EEF] What is the best way to update an EEF project?
Next Topic:[EMFForms][RAP] No render found
Goto Forum:
  


Current Time: Fri Apr 19 09:19:01 GMT 2024

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

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

Back to the top