-->
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: How to perform a non-polymorphic HQL query in Hibernate?
PostPosted: Fri Dec 03, 2010 1:10 pm 
Newbie

Joined: Fri Dec 03, 2010 1:03 pm
Posts: 4
Hi all,

I'm using Hibernate 3.3, and in particular, I'm using HQL queries.

According to the documentation, Hibernate's queries are polymorphic:
Quote:
A query like: from Cat as cat returns instances not only of Cat, but also of subclasses like DomesticCat.

How can I query for instances of Cat, but not of any of its subclasses?


I'm aware of the following options, and don't find them satisfactory:

1. Manually filtering the instances after the query, OR:
2. Manually adding a WHERE clause on the discriminator column.

I've read in other places that 'WHERE bean.class = myClass' is meant to work, but it doesn't.

It would make sense for Hibernate to allow the user to decide whether a query should be polymorphic or not, but I can't find such an option.

Thanks in advance!


Last edited by uneZzzer on Sat Dec 04, 2010 11:41 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How to perform a non-polymorphic HQL query in Hibernate?
PostPosted: Sat Dec 04, 2010 7:20 am 
Newbie

Joined: Fri Dec 03, 2010 1:03 pm
Posts: 4
anyone?


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.