-->
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: instanceof in HQL ?
PostPosted: Thu Jun 18, 2009 5:03 am 
Newbie

Joined: Wed May 06, 2009 4:36 am
Posts: 3
Hi,

i got a mapping like:
Code:
<hibernate-mapping>
  <class table="CAR" lazy="false" name="de.dot.Car">
    <property...
    <joined-subclass name="de.dot.BetterCar" table="BETTERCAR">
      <property ...

So i am not using discriminator. Is there a way to query only object of
a specific type?

When i query for Car i get all Car and BetterCar objects. I think i could do sth like
...WHERE ID NOT IN (SELECT ID FROM Bettercar).. but is there a better way ?


Top
 Profile  
 
 Post subject: Re: instanceof in HQL ?
PostPosted: Mon Jun 22, 2009 6:26 am 
Newbie

Joined: Wed May 06, 2009 4:36 am
Posts: 3
Is there no build-in mechanism ?


Top
 Profile  
 
 Post subject: Re: instanceof in HQL ?
PostPosted: Mon Jun 22, 2009 8:03 am 
Newbie

Joined: Fri Dec 14, 2007 8:44 am
Posts: 10
Dear,

use Projection Property(pls refer hibernate Criteria API for details).
It helps to get only the required entity(table) values,
despite of getting all table fields.

It works like ,
select column0A, column0B from table01

despite of,
select * from table01


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.