-->
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: Collection of joined-subclass HQL question.
PostPosted: Sat Jan 31, 2004 5:21 pm 
Newbie

Joined: Wed Nov 05, 2003 9:10 am
Posts: 6
I believe that I'm giving enough to answer the question, but if not, I'll bring in my real example with mapping files and code.

Let's say I have the following classes:

Code:
class Bat {

     Collection fooBars;

}

abstract class FooBar {

     String fooBarID;

}

class Foo extends FooBar {}
class Bar extends Bar{}


Foo and Bar are mapped as joined subclasses of FooBar.

The fooBars collection in Bat contains a number of objects, some Foo objects and some Bar objects.

What kind of HQL magic would I invoke to get all the elements of the fooBars collection that are instances of Foo?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 8:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You could try something like this:

select foos from Bat bat join bat.fooBars foos where foos.class = Foo

Don't know if this works, if somehow it might work using the .class special property, so that would be the direction to look.


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.