-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Multiple inheritance and mixed strategy
PostPosted: Thu Nov 11, 2010 4:21 am 
Newbie

Joined: Thu Nov 11, 2010 3:49 am
Posts: 4
Location: Solothurn, Switzerland
Hi

I would like to implement a two-level-hierarchy. First level uses a SINGLE_TABLE inheritance strategy with Secondary Tables for all Subclasses (e.g. BooleanCondition, see below). Second Level uses a SINGLE_TABLE strategy (no Secondary Tables for subclasses).

I tried to implement this like follows:

I quickly list the annotations I used for the Entities from top down (class hierarchy):
1: Abstract Class
Code:
@Entity
@Table(name = "CONDITION", schema = "ESV")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "CONDITION_KIND", discriminatorType = DiscriminatorType.STRING)
public abstract class Condition {

2: Abstract Class
Code:
@Entity
@SecondaryTable(name = "BOOLEAN_CONDITION", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "AS_CONDITION_ID") })
@DiscriminatorValue("BOOL_COND")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "BOOLEAN_CONDITION_TYPE", discriminatorType = DiscriminatorType.STRING)
public abstract class BooleanCondition extends Condition {

3: Concrete Class
Code:
@Entity
@DiscriminatorValue("AND")
public class AndCondition extends BooleanCondition {


Problem:
Second Hierarchy seems not to work. The Discriminiator Column is not set.
Code:
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: Einfügen von NULL in ("BOOLEAN_CONDITION"."BOOLEAN_CONDITION_TYPE") nicht möglich

Has anybody an idea how this could be done properly?

Thanks for any hints.

Michael


Last edited by mikalfa on Thu Nov 11, 2010 10:04 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Multiple inheritance and mixed strategy
PostPosted: Thu Nov 11, 2010 6:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
this is for the hibernate tools questions - not hibernate specfic ones. thanks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Multiple inheritance and mixed strategy
PostPosted: Thu Nov 11, 2010 11:25 am 
Newbie

Joined: Thu Nov 11, 2010 3:49 am
Posts: 4
Location: Solothurn, Switzerland
Sorry.

Could you move my topic (think i can't do it myself, can I).

Regs
Michael


Top
 Profile  
 
 Post subject: Re: Multiple inheritance and mixed strategy
PostPosted: Thu Nov 11, 2010 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
sorry - no, I don't have a good move thread/post button. easier if you just copy/paste.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Multiple inheritance and mixed strategy
PostPosted: Fri Nov 12, 2010 5:43 am 
Newbie

Joined: Thu Nov 11, 2010 3:49 am
Posts: 4
Location: Solothurn, Switzerland
Started Thread with the same subject under "Hibernate Users".

So this one could be removed by a moderator.

Regs
Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.