-->
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: Criteria and polymorphism
PostPosted: Mon Sep 01, 2008 11:13 am 
Newbie

Joined: Wed Sep 06, 2006 8:33 am
Posts: 19
Hi...


I have this class: A, B and C...
B and C extends the A class...

If i create a criteria to get A, i get A, B and C instances... i need only A, how i can to do this?


Top
 Profile  
 
 Post subject: Re: Criteria and polymorphism
PostPosted: Mon Sep 07, 2009 11:09 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 10:51 pm
Posts: 29
Location: sydney australia
I'd also like to know. ......

the only solution I know of is to create a non persistent class, X

and let A, B and C extend X.

but that isn't preferable....


Top
 Profile  
 
 Post subject: Re: Criteria and polymorphism
PostPosted: Wed Sep 09, 2009 8:21 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
I'm not sure, but I think this might work:

criteria.Add(Restriction.Eq("class", typeof(A))

or if System.Type is not allowed typeof(A).FullName

_________________
--Wolfgang


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.