Hi,
 
How do I test for lazy loading to assure myself that
it's working?
 
I did some test as below where user has complex collection as List
 
     long start = System.currentTimeMillis();
     
    User user = (User) dao.getUser(new Long(1));
     long elapsedTimeMillis = System.currentTimeMillis()-start;
     log.warn( "time: " + elapsedTimeMillis );
 
 
I compared the result with lazyLoadingEnabled="false" and
lazyLoadingEnabled="true"
 
For lazyLoadingEnabled="true", I got time: 62
For lazyLoadingEnabled="false", I got time: 46
 
Funny thing is for 'true' scenario, it takes longer. Is that normal?
I 'd expect shorter time since complex collection is not loaded
 
THanks
 
 
Sam

Reply via email to