> Hi, I guess I did not really understand castors lazy loading.
> Hope someone can help me...
>
> I found this on http://castor.exolab.org/castor-one.html#Lazy-Loading:
> "The elements in the collection are only loaded when the application
> asks for the object from the collection, using, for example,
> iterator.next()."
>
> Did I get the following right?
> For example:
> I have a person and this person has a collection of its addresses.
>
> For the case that I use lazy-loading for this address-collection in
> person:
> I load a person from the database and castor does NOT load the
> address-objects into the collection?
Yes, you right. Castor only loads a primary keys of related address objects
using left outer join.

> But as soon as I reference one address (by using an iterator), castor
> gets this object (with all its attributes) from the database?
Yes. With one restriction: you should call iterator.next() in the same
transaction where you load your person object. Otherwise you'll get an
exception "Transaction is closed", or something like that.

> Or do I have to care for the loading of the addresses into the
> collection myself?
No, it's not necessary.

>
> Thanks for help...
>
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to