This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
where the lazy was set as true in header.
The query returned me 5 rows because the SQL query that was fired was
"select header0_.HEADER_ID as HEADER1_0_0_,
details1_.DETAIL_ID as DETAIL1_1_1_,
details1_.HEADER_ID as HEADER2_1_1_,
details1_.HEADER_ID as HEADER2_0__,
details1_.DETAIL_ID as DETAIL1_0__
from HEADER header0_
left outer join DETAIL details1_
on header0_.HEADER_ID=details1_.HEADER_ID where header0_.HEADER_ID=1"
What i needed was to get only 1 header record, from where i could getDetails() to get the 5 records.
An alternative way of doing(what i needed) was to put lazy="false" and query like "Select h from Header h"...
However, i dont want to use lazy="false"(because i will not always be eagerly loading the details)
I had heard that using Fetch was an alternative to using lazy="false".
So, is there a way that i can use Fetch in the above case and get no of results as 1(from where i can get the 5 records) instead of getting 5 records separately.