Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] How to set identity generator strategy for "TABLE_PER_CLASS" inheritance m
[Teneo] How to set identity generator strategy for "TABLE_PER_CLASS" inheritance m [message #751941] Wed, 26 October 2011 08:01 Go to next message
Bernd Vogt is currently offline Bernd VogtFriend
Messages: 34
Registered: July 2009
Member
Hello,

I'd like to use "TABLE_PER_CLASS" as inheritance mapping strategy.

Howerver, when I try to initialize the data base for my EPackage I get
the follwoing error:

"Exception in thread "main" org.hibernate.MappingException: Cannot use
identity column key generation with <union-subclass> mapping for: Thing"

My model contains an abstract class an one concrete sub-class. The
Hibernate documentation is telling me that "the identity generator
strategy is not allowed in unionsubclass inheritance". Ok... but I
didn't figure out how to set another generator strategy???

I suspect that I have to use the annotation GeneratedValue and
MappedSuperclass on my ecore model... somehow... (I would like to avoid
annotations)

So, how to set another identity generator strategy that is valid for
"TABLE_PER_CLASS"?

Many thanks and best regards,
Bernd
Re: [Teneo] How to set identity generator strategy for &quot;TABLE_PER_CLASS&quot; inheritan [message #752350 is a reply to message #751941] Wed, 26 October 2011 11:09 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
You can prevent the generated value to be set on the id, but I am not sure that you want to do that:
see the set_generated_value_on_id_feature option here
http://wiki.eclipse.org/Teneo/Hibernate/Configuration_Options

the only other solution is to annotate the model. You can also annotate using xml so that you don't change the ecore/xsd
model itself.

gr. Martin

On 10/26/2011 10:01 AM, Bernd Vogt wrote:
> Hello,
>
> I'd like to use "TABLE_PER_CLASS" as inheritance mapping strategy.
>
> Howerver, when I try to initialize the data base for my EPackage I get the follwoing error:
>
> "Exception in thread "main" org.hibernate.MappingException: Cannot use identity column key generation with
> <union-subclass> mapping for: Thing"
>
> My model contains an abstract class an one concrete sub-class. The Hibernate documentation is telling me that "the
> identity generator strategy is not allowed in unionsubclass inheritance". Ok... but I didn't figure out how to set
> another generator strategy???
>
> I suspect that I have to use the annotation GeneratedValue and MappedSuperclass on my ecore model... somehow... (I would
> like to avoid annotations)
>
> So, how to set another identity generator strategy that is valid for "TABLE_PER_CLASS"?
>
> Many thanks and best regards,
> Bernd


--

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] How to set identity generator strategy for &quot;TABLE_PER_CLASS&quot; inheritan [message #752686 is a reply to message #752350] Wed, 26 October 2011 13:32 Go to previous messageGo to next message
Bernd Vogt is currently offline Bernd VogtFriend
Messages: 34
Registered: July 2009
Member
Hi

> see the set_generated_value_on_id_feature option here

I set this option to "false" wit no effect.

> the only other solution is to annotate the model

I played around wit annotations and added @MappedSuperclass to my
abstract super types. But the I got another error telling me that he is
not ablte to establish references to that "unmapped" super types:

"org.hibernate.MappingException: An association from the table
annotation refers to an unmapped class: Annotatable"

Is it even possible to use the inheritance mapping "TABLE_PER_CLASS"
along with Teneo?

You maybe mentioned that I'm not realy into Hibernate and Teneo ;-)
Please, tell me what I have to consider with "TABLE_PER_CLASS" or point
me to ab example...

Thanks,
Bernd
Re: [Teneo] How to set identity generator strategy for &quot;TABLE_PER_CLASS&quot; inheritan [message #753101 is a reply to message #752686] Wed, 26 October 2011 16:27 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Bernd,
I guess that you have ereferences pointing to the type you are assigning as a mappedsuperclass, this is not supported
with hbm.

Strange that the option does not work... it is there and the code to handle it is also there. But again in this

Can you send me the model? My private email is mtaal@elver.org.

gr. Martin

On 10/26/2011 03:32 PM, Bernd Vogt wrote:
> Hi
>
>> see the set_generated_value_on_id_feature option here
>
> I set this option to "false" wit no effect.
>
>> the only other solution is to annotate the model
>
> I played around wit annotations and added @MappedSuperclass to my abstract super types. But the I got another error
> telling me that he is not ablte to establish references to that "unmapped" super types:
>
> "org.hibernate.MappingException: An association from the table annotation refers to an unmapped class: Annotatable"
>
> Is it even possible to use the inheritance mapping "TABLE_PER_CLASS" along with Teneo?
>
> You maybe mentioned that I'm not realy into Hibernate and Teneo ;-) Please, tell me what I have to consider with
> "TABLE_PER_CLASS" or point me to ab example...
>
> Thanks,
> Bernd


--

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:[CDO] doubts related to model modularity
Next Topic:How to list entries in a ArchiveURLConnection?
Goto Forum:
  


Current Time: Fri Apr 26 14:21:42 GMT 2024

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

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

Back to the top