-->
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.  [ 4 posts ] 
Author Message
 Post subject: Polymorphic queries on a joined-subclass hierarchy
PostPosted: Wed Apr 19, 2006 9:32 am 
Beginner
Beginner

Joined: Wed Apr 19, 2006 9:16 am
Posts: 24
Hibernate version:
NHibernate 1.0.2 / Releasedate 15-01-2006

Hi, when the inheritance tree is mapped as a joined-subclass mapping,
is it possible to specify a subclass within that hierarchy in the where clause of an HQL query? I've seen the "from Cat cat where cat.class=DomesticCat" variant, but that makes use of the discriminator value.

So if the inheritancetree looks like this

Instrument
|
Aerophone
| |
Clarinet Trumpet

mapped as joind-subclasses (taking up 4 tables),
I'd like to issue a query of the form "from Instrument i where i.class= Aerophone", that would return all Aerophones.

I know the "from Aerophone" query would return them also, I'd just like to know if there is a way to do it as described above.

Regards & TIA,

Willem van Rumpt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 11:20 am 
Regular
Regular

Joined: Tue Jan 03, 2006 11:43 am
Posts: 51
Location: Sweden
I need to know this as well. For a more complex query.

/Carl


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 3:55 pm 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
the query is valid but unfortunately there is a bug in the HQL parser which prevents it to return the correct results. You should vote for this bug:
http://jira.nhibernate.org/browse/NH-571

more details here: http://forum.hibernate.org/viewtopic.php?t=957690&highlight=

cheers,
radu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 10:16 am 
Beginner
Beginner

Joined: Wed Apr 19, 2006 9:16 am
Posts: 24
Thanks for the info,
The number of votes has gone up by 1 :)

regards,
Willem van Rumpt


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.