-->
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.  [ 1 post ] 
Author Message
 Post subject: Query subclass property in table per class hierarchy
PostPosted: Fri Aug 09, 2013 8:55 am 
Newbie

Joined: Fri Aug 09, 2013 8:24 am
Posts: 1
Let's say I have an abstract class Car with 2 subclasses - Truck and Sedan. The Car, Truck, and Sedan class have the following properties:

Car - color, max passengers, model
Truck - num of wheels
Sedan - has removable top

I have my hibernate annotations configured to follow the table per class hierarchy design. I have a discriminator column cartype with values 'T' or 'S'. I am trying to create one criteria or HQL to search for all black color trucks with 6 wheels and all black color sedan with a removable top. Is there a way for me to create one query to return the Car objects that match that particular search criteria. I would like to avoid hitting the database twice and then combining the result of the queries.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.