Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Make generated EMF classes implement Serializable
Make generated EMF classes implement Serializable [message #509031] Thu, 21 January 2010 08:56 Go to next message
Svetoslav Missing name is currently offline Svetoslav Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

I have emf data model and I am using Teneo for persistence. However because I am using JSF for presentation I need to make the generated EMF classes implement Serializable. How can I achieve this?

Thank you!
Re: Make generated EMF classes implement Serializable [message #509039 is a reply to message #509031] Thu, 21 January 2010 04:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Svetoslav,
What I do myself is the following (but maybe others have better ideas):
- create an interface which extends both EObject and Serializable
- then in the genmodel in the field, root extends interface, set this interface and then regenerate the classes

Let me know if this works for you.

gr. Martin

Svetoslav wrote:
> Hi.
>
> I have emf data model and I am using Teneo for persistence. However
> because I am using JSF for presentation I need to make the generated EMF
> classes implement Serializable. How can I achieve this?
>
> Thank you!


--

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: Make generated EMF classes implement Serializable [message #509067 is a reply to message #509039] Thu, 21 January 2010 10:34 Go to previous messageGo to next message
Svetoslav Missing name is currently offline Svetoslav Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

Thank you for the quick reply. I have thought of that way but I didn't want to do it like that because Teneo would generate some unnecessary tables in the database and it will cause some overhead. I have read somewhere about Teneo annotations and that I could control the generation of the table that way but it seems too much work to manually add annotations to all the classes.. I have read some JET tutorials and probably I could achieve that by JET but I couldn't find how can I use it along with EMF model generation.
Re: Make generated EMF classes implement Serializable [message #509072 is a reply to message #509067] Thu, 21 January 2010 10:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Svetoslav,
Afaics no new tables would be generated in this way. The generated interfaces already extend EObject and Serializable
does not add anything. Let me know what you see happening if it is different.

Yes you can add annotations directly in the model (http://www.elver.org/hibernate/ejb3_format.html), but afaics it is
not needed in this case.

gr. Martin

Svetoslav wrote:
> Hi.
>
> Thank you for the quick reply. I have thought of that way but I didn't
> want to do it like that because Teneo would generate some unnecessary
> tables in the database and it will cause some overhead. I have read
> somewhere about Teneo annotations and that I could control the
> generation of the table that way but it seems too much work to manually
> add annotations to all the classes.. I have read some JET tutorials and
> probably I could achieve that by JET but I couldn't find how can I use
> it along with EMF model generation.


--

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: Make generated EMF classes implement Serializable [message #509095 is a reply to message #509072] Thu, 21 January 2010 11:42 Go to previous message
Svetoslav Missing name is currently offline Svetoslav Missing nameFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

Thank you for the help! The first time I misunderstood you.. I thought that you are suggesting to create a new interface in the model and assign it to ESuper Type to all classes. It works fine the way you told me. Thanks again!
Re: Make generated EMF classes implement Serializable [message #509101 is a reply to message #509072] Thu, 21 January 2010 07:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30653
Registered: July 2009
Senior Member
Guys,

This bugzilla has relatively complete patches (along the line of what
Martin is suggesting) for supporting this
https://bugs.eclipse.org/bugs/show_bug.cgi?id=245014


Martin Taal wrote:
> Hi Svetoslav,
> Afaics no new tables would be generated in this way. The generated
> interfaces already extend EObject and Serializable does not add
> anything. Let me know what you see happening if it is different.
>
> Yes you can add annotations directly in the model
> (http://www.elver.org/hibernate/ejb3_format.html), but afaics it is
> not needed in this case.
>
> gr. Martin
>
> Svetoslav wrote:
>> Hi.
>>
>> Thank you for the quick reply. I have thought of that way but I
>> didn't want to do it like that because Teneo would generate some
>> unnecessary tables in the database and it will cause some overhead. I
>> have read somewhere about Teneo annotations and that I could control
>> the generation of the table that way but it seems too much work to
>> manually add annotations to all the classes.. I have read some JET
>> tutorials and probably I could achieve that by JET but I couldn't
>> find how can I use it along with EMF model generation.
>
>
Previous Topic:[Transaction] Editor to use single write transaction to modify EMF model until disposed
Next Topic:How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4)
Goto Forum:
  


Current Time: Thu Nov 21 08:03:13 GMT 2019

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

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

Back to the top