Quote:
now i have the hibernate objects:
hotel.hbm.xml this one has a Set of amenity
amenity.hbm.xml this one has a Set of amenityDetails
lang.hbm.xml
amenityDetails.hbm.xml
with fetch feature, you'll be able to load amenity set in your Hotel but not amenityDetails, not in one HQL query.
I think the best is:
1st query: something like "select hotel from Hotel as hotel fetch join hotel.amenities "
then: for each elements of amenities call
"select amenity from Amenity as amenity fetch join amenity.amenityDetails"
with this you'll have 1+n queries
n = number of amenities
the rule is: you can fetch many "to-one" associated objects but ONLY one to-many associated collection per query.
The goal is to fetch all collections, then you'll be able to work with the root hotels, their graph will be loaded.
You'll have to be an expert of "select elements(...)" and of "fetch" keyword