I would like to ask something about Hibernate.initialize().
I have a pojo named
Item.This pojo is
LAZY.
So in my ItemDao class I get my pojo:
Code:
Item item = session.get(Item.class, itemId); -->THERE IS A SELECT HERE
Then I get the following list:
Code:
List bids = item.getBids(); --->THERE IS NO QUERY HERE
and I
iterate the bids list and it is then that I have a
SECOND SELECTHowever if after get the Item pojo I do sth like that:
Code:
Hibernate.initialize(item.getBids) --> THERE IS A SELECT HERE
and if afterwards I
iterate the list there are no selects.
My question is?What is the difference between the two ways I describe?
Why should I use Hibernate.initialize()?What does it offer?I see the same number of queries every time.
Any suggestions?