Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [TENEO] IdentifierGenerator
[TENEO] IdentifierGenerator [message #425368] Sat, 22 November 2008 18:44 Go to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
Hello,

This is somewhat related to my earlier post (IPersistable interface with
a myid property that could get implemented by all entities in the model)

I tried to dig a little more and here is my "second" question reloaded:

1. Could I use the strategy property of the GenericGenerator to indicate
the use of a custom IdentifierGenerator ?

2. Could this custom IdentifierGenerator extend the TableHiLoGenerator?

3. Is there any way I could inject the name of the entity being
persisted into this custom TableHiLoGenerator? Note that the adnotation
will be made on the IPersistable interface.

Please see my earlier post for the spadcore.ecore attachment.

Thanks a lot for your patience
Liviu
Re: [TENEO] IdentifierGenerator [message #425376 is a reply to message #425368] Sun, 23 November 2008 06:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Liviu,
Yes the strategy attribute should have the class name of your IdentifierGenerator.

The IdentifierGenerator.generate method has a session and a object parameter. The object is the
entity which gets persisted. You can cast this object to EObject and ask for the eclass and use the
eclass name and epackage or use the classname.

Looking at the Hibernate source code I think it can make sense to implement your own
TableHiLoGenerator which combines the logic from the TableHiLoGenerator and TableGenerator and uses
the class/eclass as an additional parameter in the sql queries.

gr. Martin

Liviu wrote:
> Hello,
>
> This is somewhat related to my earlier post (IPersistable interface with
> a myid property that could get implemented by all entities in the model)
>
> I tried to dig a little more and here is my "second" question reloaded:
>
> 1. Could I use the strategy property of the GenericGenerator to indicate
> the use of a custom IdentifierGenerator ?
>
> 2. Could this custom IdentifierGenerator extend the TableHiLoGenerator?
>
> 3. Is there any way I could inject the name of the entity being
> persisted into this custom TableHiLoGenerator? Note that the adnotation
> will be made on the IPersistable interface.
>
> Please see my earlier post for the spadcore.ecore attachment.
>
> Thanks a lot for your patience
> Liviu


--

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] IdentifierGenerator [message #425380 is a reply to message #425376] Sun, 23 November 2008 11:56 Go to previous messageGo to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
Yep, that hit the spot - its all answered and crystal clear.

I could just say thanks, but then again sounds better: You The Man.
Like Tyrell and Lorenzo all rolled into one.
Check this out - googled it specially for you:
http://www.theonion.com/content/node/34216

Liviu
Martin Taal wrote:
> Hi Liviu,
> Yes the strategy attribute should have the class name of your
> IdentifierGenerator.
>
> The IdentifierGenerator.generate method has a session and a object
> parameter. The object is the entity which gets persisted. You can cast
> this object to EObject and ask for the eclass and use the eclass name
> and epackage or use the classname.
>
> Looking at the Hibernate source code I think it can make sense to
> implement your own TableHiLoGenerator which combines the logic from the
> TableHiLoGenerator and TableGenerator and uses the class/eclass as an
> additional parameter in the sql queries.
>
> gr. Martin
>
> Liviu wrote:
>> Hello,
>>
>> This is somewhat related to my earlier post (IPersistable interface with
>> a myid property that could get implemented by all entities in the model)
>>
>> I tried to dig a little more and here is my "second" question reloaded:
>>
>> 1. Could I use the strategy property of the GenericGenerator to indicate
>> the use of a custom IdentifierGenerator ?
>>
>> 2. Could this custom IdentifierGenerator extend the TableHiLoGenerator?
>>
>> 3. Is there any way I could inject the name of the entity being
>> persisted into this custom TableHiLoGenerator? Note that the adnotation
>> will be made on the IPersistable interface.
>>
>> Please see my earlier post for the spadcore.ecore attachment.
>>
>> Thanks a lot for your patience
>> Liviu
>
>
Re: [TENEO] IdentifierGenerator [message #425388 is a reply to message #425380] Mon, 24 November 2008 05:21 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ha ha, thanks, :-),

gr. Martin

Liviu wrote:
> Yep, that hit the spot - its all answered and crystal clear.
>
> I could just say thanks, but then again sounds better: You The Man.
> Like Tyrell and Lorenzo all rolled into one.
> Check this out - googled it specially for you:
> http://www.theonion.com/content/node/34216
>
> Liviu
> Martin Taal wrote:
>> Hi Liviu,
>> Yes the strategy attribute should have the class name of your
>> IdentifierGenerator.
>>
>> The IdentifierGenerator.generate method has a session and a object
>> parameter. The object is the entity which gets persisted. You can cast
>> this object to EObject and ask for the eclass and use the eclass name
>> and epackage or use the classname.
>>
>> Looking at the Hibernate source code I think it can make sense to
>> implement your own TableHiLoGenerator which combines the logic from the
>> TableHiLoGenerator and TableGenerator and uses the class/eclass as an
>> additional parameter in the sql queries.
>>
>> gr. Martin
>>
>> Liviu wrote:
>>> Hello,
>>>
>>> This is somewhat related to my earlier post (IPersistable interface with
>>> a myid property that could get implemented by all entities in the model)
>>>
>>> I tried to dig a little more and here is my "second" question reloaded:
>>>
>>> 1. Could I use the strategy property of the GenericGenerator to indicate
>>> the use of a custom IdentifierGenerator ?
>>>
>>> 2. Could this custom IdentifierGenerator extend the TableHiLoGenerator?
>>>
>>> 3. Is there any way I could inject the name of the entity being
>>> persisted into this custom TableHiLoGenerator? Note that the adnotation
>>> will be made on the IPersistable interface.
>>>
>>> Please see my earlier post for the spadcore.ecore attachment.
>>>
>>> Thanks a lot for your patience
>>> Liviu
>>


--

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:non-compact xml serialization
Next Topic:[Transactions] Deadlock using WorkspaceSynchronizer.Delegate
Goto Forum:
  


Current Time: Thu Apr 18 23:05:36 GMT 2024

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

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

Back to the top