This content has been marked as final.
Show 1 reply
-
1. Re: How to retrieve foreign key instead of the object (want
alexg79 Dec 5, 2007 5:44 AM (in response to lpmon)
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.