[jboss-user] [EJB 3.0] - Re: How to retrieve foreign key instead of the object (want

alexg79 do-not-reply at jboss.com
Wed Dec 5 05:44:52 EST 2007

anonymous wrote : 
  | int modelId = u.getModel().getId(); // causes read of Model table!
  | Issue - this will cause a read of the model row from the DB (won't it, as in lazy loading will perform a JIT read)
No it won't. You obviously haven't tried it, or you wouldn't be asking about it. The ID field of the association is special in the way that reading it will NOT trigger lazy loading. Any other operation on the lazy object, however, will.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110463#4110463

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110463

More information about the jboss-user mailing list