Hi,
May be this is a simple question... but I'd searched for a while and found nothing about it.
When you query for objects using HQL, for example "from Car c where c.year>?", Hibernate uses two SQL statements:
* The very first one retrieves the Id's of the resulting records:
SELECT CAR_ID FROM CARS WHERE CAR_YEAR>?
* The second one retrieves all the fields of each record whenever it is accessed:
SELECT CAR_MODEL, CAR_COLOUR, CAR_YEAR FROM CARS WHERE CAR_ID=?
Is it possible to instruct Hibernate to get an object in a "one-shot" SQL? I mean, is it possible for Hibernate to issue a single SQL statement like:
SELECT * FROM CARS WHERE CAR_YEAR>?
Thanks in advance!
|