views:

32

answers:

1

I use a stateless session and the follow HQL.

CreateQuery("select a from Address a")

My Address Class has many BankDetails but i can't access. If i use a normal session it works. What can I do?

+1  A: 

Use a fetch join to pull in the bank details explicitly rather than relying on an implicit load when you first access the BankDetails property:

CreateQuery("select a from Address a inner join fetch a.BankDetails")

HTH,
Kent

Kent Boogaart
Thank's Kent. Is there a generally option to pull all data?
Rheinprinz
You can add lazy="false" in your mapping to ensure that certain collections are always loaded eagerly, but beware of the performance implications.
Kent Boogaart
The result of the query is not unique. It's the same count like the Bankdetails. What can i do?
Rheinprinz