-->
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: Custom discriminator possible?
PostPosted: Mon Jul 07, 2008 12:08 pm 
Newbie

Joined: Mon Jul 07, 2008 9:45 am
Posts: 1
Hello.

When using the inheritance mapping strategy 'table per class hierarchy', one has to specify the discriminator column and its value for every concrete class to be mapped.

I wonder whether it's possible to map such case without using a discriminator column. I mean, one can see it in a more general way: we have the values read from the DB and we now have to decide which class must be instantiated. Discriminator column is one way to do this, it uses the value of the specified column to derive the class. Is it possible to specify a custom 'resolver' for this?

My case is that in my table, I have two columns of which exactly one is not NULL. Depending on which one is not NULL, the one or the other class should be instantiated. Can I achieve this without introducing the discriminator column? I could provide a custom 'discriminator' that would look at these two columns and tell which class should be instantiated. Further field filling goes the usual hibernate way. Is it possible to hook such a discriminator and how?

Any help is much appreciated.


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.