Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] table_per_class and id generation tips([Teneo] table_per_class and id generation tips)
[Teneo] table_per_class and id generation tips [message #1076712] Wed, 31 July 2013 19:23 Go to next message
Andrew Whelan is currently offline Andrew WhelanFriend
Messages: 71
Registered: October 2012
Location: Syracuse NY
Member
Hello,

I am kind of stuck here. I am using Teneo. I need to use the table_per_class inheritance mapping strategy but I also want each of those tables to have a generated (long or integer) ID (I don't want to have to mess with having to manage ID generation in Java code).

The table_per_class strategy seems to have a limitation of generated id's not being supported. In the following thread

http://www.eclipse.org/forums/index.php/m/911763/?srch=%22Cannot+use+identity+column+key+generation+with+%3Cunion-subclass%3E%22#msg_911763

Martin says to change the id generation. I'm not sure if he means to use some other generation annotation? Is there a reasonable scheme to generate ids without using the "id generation" that table_per_class cannot handle? I'm looking through all of the Teneo documentation and examples but nothing is clicking.
Thanks
-Andrew
Re: [Teneo] table_per_class and id generation tips [message #1076789 is a reply to message #1076712] Wed, 31 July 2013 21:38 Go to previous messageGo to next message
Andrew Whelan is currently offline Andrew WhelanFriend
Messages: 71
Registered: October 2012
Location: Syracuse NY
Member
FYI: I can't use the MappedSuperclass option either because of the old ereferences exception "org.hibernate.MappingException: Association references unmapped class". Please help!
Just to make sure I am being clear if I have

class Person{
  String gender;
  String age;
}

class PoliceMan extends Person{
  String badgeNumber;
}



how can I configure teneo to have a generated ID field and have
a table PoliceMan with the fields

e_id(the generated id field), gender, age, and badgeNumber using the scenario above.

Thanks!
Re: [Teneo] table_per_class and id generation tips [message #1076808 is a reply to message #1076789] Wed, 31 July 2013 22:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Andrew,
I am not sure if table-per-class will work if mappedsuperclass doesn't work either.

Can't you use a custom id generator? I am more and more in favor of string/uuids as id's instead of these long/integer ids.

gr. Martin

On 07/31/2013 11:38 PM, Andrew Whelan wrote:
> FYI: I can't use the MappedSuperclass option either because of the old ereferences exception
> "org.hibernate.MappingException: Association references unmapped class". Please help!
> Just to make sure I am being clear if I have
>
>
> class Person{
> String gender;
> String age;
> }
>
> class PoliceMan extends Person{
> String badgeNumber;
> }
>
>
>
> how can I configure teneo to have a generated ID field and have
> a table PoliceMan with the fields
>
> e_id(the generated id field), gender, age, and badgeNumber using the scenario above.
>
> Thanks!


--

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] table_per_class and id generation tips [message #1077362 is a reply to message #1076789] Thu, 01 August 2013 15:43 Go to previous messageGo to next message
Andrew Whelan is currently offline Andrew WhelanFriend
Messages: 71
Registered: October 2012
Location: Syracuse NY
Member
>Hi Andrew,
>I am not sure if table-per-class will work if mappedsuperclass doesn't work either.

>Can't you use a custom id generator? I am more and more in favor of string/uuids as >id's instead of these long/integer ids.

Are you suggesting that we add an implicit ID field to our model and manage our own IDs or is there a neat way to do this with annotations in Teneo? If there is could you give me an example?
Thanks!


>gr. Martin

[Updated on: Thu, 01 August 2013 15:54]

Report message to a moderator

Re: [Teneo] table_per_class and id generation tips [message #1077935 is a reply to message #1077362] Fri, 02 August 2013 10:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Andrew,
Yes you can use the standard JPA 2.0 annotations on that explicit id eattribute to control how to generate id's.
Explicit id efeatures are better in my opinion than implicit ones.

gr. Martin

On 08/01/2013 05:43 PM, Andrew Whelan wrote:
>> Hi Andrew,
>> I am not sure if table-per-class will work if mappedsuperclass doesn't work either.
>
>> Can't you use a custom id generator? I am more and more in favor of string/uuids as >id's instead of these
>> long/integer ids.
>
> Are you suggesting that we add an implicit ID field to our model and manage our oun IDs or is there a neat way to do
> this with annotations in Teneo? If there is could you give me an example? Thanks!
>
>
>> gr. Martin
>
>


--

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:Strange behavior with substitution groups
Next Topic:two (or more) models with a common ancestor
Goto Forum:
  


Current Time: Thu Apr 25 13:44:15 GMT 2024

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

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

Back to the top