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.
|