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.  [ 1 post ] 
Author Message
 Post subject: Multiple inheritance and mixed strategy
PostPosted: Fri Nov 12, 2010 5:28 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


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

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.