-->
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: DetachedCriteria.forClass also loads the subclass as well
PostPosted: Thu Oct 04, 2007 11:27 am 
Newbie

Joined: Thu Oct 04, 2007 10:17 am
Posts: 1
Hi All,

I have two classes A and B, with class B is the sub class of class A. These two classes are mapped to two tables (table TA and TB) independently.

Right now looks like if I want to do a query to get just the records in table TA which Class A maps against. When I use the following
DetachedCriteria.forClass(A.class)

The returned result sets include both instances of Class A as well as Class B. Also I can see there are two sql queries have been issued by Hibernate to database with one sql queries table TA and another one for table TB.

Is there a way I can let Hibernate know that only the specified class( not its subclasses) need to be returned?

Thanks a lot for any idea you might have on this.

-Harriet


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 7:46 am 
Newbie

Joined: Fri Oct 27, 2006 3:02 am
Posts: 4
sorry i was trying to post new topic but got it as reply to your's


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 9:04 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
Go through following links, you might find them helpful

http://forum.hibernate.org/viewtopic.ph ... highlight=

http://opensource.atlassian.com/project ... se/HHH-746

Please note the workaround mentioned, i.e. using the discriminator directly.

_________________
Please rate this post if you find it helpful


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.