-->
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.  [ 3 posts ] 
Author Message
 Post subject: support for multiple discriminator columns?
PostPosted: Sat Aug 12, 2006 3:49 pm 
Newbie

Joined: Sat Aug 12, 2006 3:20 pm
Posts: 1
I am trying to map multiple levels of inheritance via two discriminator columns and dont see a way to do this via the EJB3.0 annotations.

There is a single table,

Code:
authorization
----------------
auth_id int identity
name
description
auth_type_id
auth_action_type_id


the auth_type_id is used to pick the general type of the authorization,
and the auth_action_type_id is used to pick the subclass of that type.

Code:
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="auth_type_id",discriminatorType=DiscriminatorType.INTEGER)
public abstract class Authorization {
      ............
}


@Entity
@DiscriminatorValue("1")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="auth_action_type_id",discriminatorType=DiscriminatorType.INTEGER)
public abstract class SystemAuthorization extends Authorization {
     .............
}

@Entity
@DiscriminatorValue("2")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="auth_action_type_id",discriminatorType=DiscriminatorType.INTEGER)
public abstract class CustomAuthorization extends Authorization {
     ...............
}

@Entity
@DiscriminatorValue("15")
public class SystemReadAuthorization extends SystemAuthorization {
     ...............
}

@Entity
@DiscriminatorValue("16")
public class CustomExecAuthorization extends CustomAuthorization {
      ...............
}


with mapping like this Hibernate does not complain at all, but ignores completely the second discriminator column.

for the query "from CustomExecAuthorization" what i want is:
Code:
select * from authorization where auth_type_id = 2 and auth_action_type_id = 16


but i get instead:
Code:
select * from authorization where auth_type_id = 16


anyone know what I am doing wrong here?


Top
 Profile  
 
 Post subject: Re: support for multiple discriminator columns?
PostPosted: Tue Oct 18, 2011 3:04 am 
Newbie

Joined: Tue Oct 18, 2011 2:56 am
Posts: 2
I have the similar problem. I could see nobody replied to this post. Kinldy help me with the solution for his problem.


Top
 Profile  
 
 Post subject: Re: support for multiple discriminator columns?
PostPosted: Tue Oct 18, 2011 4:28 am 
Contributor
Contributor

Joined: Mon Feb 28, 2011 7:27 pm
Posts: 20
Location: France
Hi,

For questions related to Hibernate and JPA, please use this forum section viewforum.php?f=1

I hope you'll have an answer!

Thanks

--Kevin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.