ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dodo" <j2eed...@gmail.com>
Subject testing for lazy loading
Date Wed, 14 Jun 2006 22:00:21 GMT

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 

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


View raw message