Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fetch as {select|join} not working as expected - hibrnate3

 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following code:




I am setting fetch as {select|join}. In both cases the get the following output in the following loop:

if(e2!=null)
{
System.out.println("not null"); //line1
//System.out.println(e2.getFirstname()); //line2
}

and no select query is being fired on db.

My understanding is that in case of fetch="select", the proxy is loaded so the select query is not being fired. But in case fetch="join" eager loading should take place and select query should be fired immediately when instance is loaded from session. In none of the cases no selet query if fired.





Please clarify. Thanks.
 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



In case i uncomment line2 the following query is fired irrespective of fetch as {select|join}

System.out.println("not null"); //line1
System.out.println(e2.getFirstname()); //line2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic