-->
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: filter collection which is for table per class hierarchy
PostPosted: Wed Aug 17, 2005 9:45 pm 
Beginner
Beginner

Joined: Tue Apr 12, 2005 9:15 pm
Posts: 24
I have a superclass A that has 2 sub-classes B and C. I want to map them as "table per class hierarchy" structure. I have a parent class P has that collection of class A. My parent class P also has another collection of class X.
I want to do a query to get all class P objects that have X.cardtype = "SA" and I want to get only the objects that are of class B in that other collection of class A (because I am using table per subclass, I have only table A persisted)
When I perform my query, to avoid a caterisian join, I query for all object P that have X.cardtype = "SA".
Then, I want to enable a filter and with fetch=sub-select (defined in mapping for collection A) that would get me only the sub-class B objects.
My question is:
1. with "table per class hierarchy" class in my collection, is it possible to write a filter that would give me only the collection objects of a particular sub-class?
2. What other way I can accomplish my query? I want to stick with the "table per class hierarchy" instead of "table per class" to avoid uncessary joins. Class P will have more than million records.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 9:57 pm 
Beginner
Beginner

Joined: Tue Aug 16, 2005 11:06 pm
Posts: 46
You can do that by setting

polymorphism = explicit

in your persistent class.

_________________
Jason Li
Don't forget to rate:)


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.