ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: R: iBatis Book - Lazy Loading Description
Date Fri, 05 Jan 2007 14:22:32 GMT
You can get the paperback version here:

http://www.amazon.com/gp/product/1932394826?ie=UTF8&tag=ai0e-20&link_code=as3&camp=211189&creative=373489&creativeASIN=1932394826

Larry


On 1/5/07, De Gaetano Giuseppe <degaetano@pitagora.it> wrote:
>
>
>
>
> Hi, I am also new to ibatis.
>
> I would like to know the title of the book you are using.
>
> I am  interested in buying iBatis in action.  Have you read this book.
>
>
>
> Thanks,
>
> giuseppe
>
>
>
>  ________________________________
>
>
> Da: Kuntz, Tim [mailto:tim_kuntz@pamperedchef.com]
>  Inviato: venerdì 5 gennaio 2007 3.24
>  A: user-java@ibatis.apache.org
>  Oggetto: iBatis Book - Lazy Loading Description
>
>
>
> The new iBatis book describes lazy-loading as follows (pg 131).
>
> "To use lazy loading, we need to edit the SqlMapConfig.xml file to enable it
> by changing the lazyLoadingEnabled attribute to true in the <setting>
> element. If you want to use the cglib enhanced version of lazy loading, you
> will want to download it, add it to your application's classpath, and change
> the enhancementEnabled attribute of the <setting> element to true as well."
>
> After setting up a sample similar to that in the book, I noticed that
> lazy-loading only appears to work correctly if BOTH lazyLoadingEnabled and
> enhancementEnabled are set to true. Running the following code executes the
> selects as the objects are requested.
>
> person = sqlMapper.queryForObject("Person.selectPerson"); // runs select ...
> from person
>
> person.getAddress(); // runs select .. from address
>
> person.getAddress().getState(); // runs select .. from state
>
> Setting enhancementEnabled to false causes all of the select statements to
> execute initially. Changing lazyLoadingEnabled to false doesn't change the
> behavior.
>
> person = sqlMapper.queryForObject("Person.selectPerson"); // runs all 3
> select statements
>
> person.getAddress();
>
> person.getAddress().getState();
>
> Is this correct behavior? If so, when would I benefit from
> lazyLoadingEnabled = "true"?
>
> I'm using iBatis version 2.3.0.677
>
> Thanks,
>
> Tim

Mime
View raw message