-->
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.  [ 2 posts ] 
Author Message
 Post subject: list discrimiator values in a select box
PostPosted: Thu Nov 13, 2008 1:29 pm 
Newbie

Joined: Thu Nov 13, 2008 12:19 pm
Posts: 1
Hi
I have a class and a subclass which uses a discriminator in order to differentiate between the two classes. I want to get the list of all possible values of discriminator column.
So, I have a class:
<class name="ContentCollection" table="CONTENT_COLLECTION" discriminator-value="N">
<id name="contentCollectionId" column="CONTENT_COLLECTION_ID" type="long">
<generator class="identity"/>
</id>
<discriminator column="COLLECTION_DISCRIMINATOR" force="false" insert="true" not-null="true" type="character"/>
<subclass discriminator-value="I" name="ContentCollectionInherited" select-before-update="false">
<property column="MAX_RESULTS" generated="never" lazy="false" name="maxResults" type="integer"/>
</subclass>
</class>


And I want something like :
ArrayList list=<parentclass>.listAllPossibleDiscriminatorValues();

and list should have N and I values.

I searched a lot about this issue but couldn't get any informative link. Any help is highly appreciated.
*The class has some other columns and properties but removed in order to concentrate on the problem


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 6:10 pm 
Newbie

Joined: Mon Dec 10, 2007 8:50 pm
Posts: 7
you can write an HQL query

String query = " from ContentCollection cc "+
" where "+
" cc.class = ContentCollectionInherited"+

Query q = createQuery(query);

hope this helps!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.