|
Re: [Teneo] idBag ID generator [message #1063929 is a reply to message #1063911] |
Sun, 16 June 2013 06:52 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi R Deepak,
Afaik the Idbag annotation has a generator attribute which can be use to set the generator, have you tried that?
gr. Martin
On 06/15/2013 07:31 AM, R Deepak wrote:
> Can the ID generator for idBag be made configurable?
>
> I am using Teneo 1.2.0.v201202122052.
> I want to change the ID generator for idBag to sequence. If I run 2 JVMs, and they write to the same collection in
> parallel, we get a unique constraint violation exception.
>
> I looked at AbstractAssociationMapper in method
>
> protected Element addCollectionElement
>
>
> The generator is hard coded to increment.
>
>
> if (idBag != null) {
> final String generator = (idBag.getGenerator() == null ? "increment"
> : idBag.getGenerator());
> final String type = (idBag.getType() == null ? "long" : idBag
> .getType());
> // if (false && idBag.getTable() != null) {
> // collectionElement.addAttribute("table", idBag.getTable());
> // }
> final Element collectionIdElement = collectionElement
> .addElement("collection-id");
> collectionIdElement.addAttribute("column",
> hbmContext.getIdbagIDColumnName());
> collectionIdElement.addAttribute("type", type);
>
> collectionIdElement.addElement("generator").addAttribute("class",
> generator);
> }
>
--
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: [Teneo] idBag ID generator [message #1064247 is a reply to message #1064172] |
Tue, 18 June 2013 11:57 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Deepak,
You can not override the abstract class but you can override one of its subclasses and override specific methods. Check
out the source code. Then you can tell Teneo to use your class with this mechanism:
http://wiki.eclipse.org/Teneo/Hibernate/Extensions
gr. Martin
On 06/18/2013 07:18 AM, R Deepak wrote:
> Hi Martin
>
> Martin Taal wrote on Sun, 16 June 2013 02:52
>> Hi R Deepak,
>> Afaik the Idbag annotation has a generator attribute which can be use to set the generator, have you tried that?
>
>
> The model I am using is too big and complex. So, I have not tuned individual collections. May not be a viable option for
> me..
>
> I have used the global option
> teneo.mapping.map_all_lists_as_idbag
>
> Will it work if I modify AbstractAssociationMapper and change increment to sequence?
>
> Thanks
> Deepak
--
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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02654 seconds