You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by sgomez <sa...@gmail.com> on 2008/03/27 21:25:16 UTC

OCM - Help with lazy loading using proxy=true

Hi everyone.

I'm trying to lazy load a collection mapped with the attribute proxy=true
but it doesn't seem to work. Maybe I haven't understood the concept of lazy
loading in this context, because I've read it waits until the getter method
is called to retrieve the collection, but I can't find any sense in that.
I'd quote where I read it from but I can't find it right now and I'm in a
bit of a hurry. I'll follow up with the quote when I find it if someone
finds it appropriate.

The doubts that have rose since I tried using the lazy load are: What will
you get when calling ocm.getObject(path) on a path pointing to an object
with lazy loading collections? Will you get the object with it lists being
null? How do you test if the collections have been really lazy loaded if by
calling the getter you make the collections be fetched from the repository?

I hope I've explained myself well enough for someone to give me some
indications on how to implement this lazy loading.

Best regards.

Sebastian Gomez.
-- 
View this message in context: http://www.nabble.com/OCM---Help-with-lazy-loading-using-proxy%3Dtrue-tp16333341p16333341.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM - Help with lazy loading using proxy=true

Posted by Christophe Lombart <ch...@gmail.com>.
On Thu, Mar 27, 2008 at 9:25 PM, sgomez <sa...@gmail.com> wrote:
>
>  Hi everyone.
>
>  I'm trying to lazy load a collection mapped with the attribute proxy=true
>  but it doesn't seem to work. Maybe I haven't understood the concept of lazy
>  loading in this context, because I've read it waits until the getter method
>  is called to retrieve the collection, but I can't find any sense in that.
>  I'd quote where I read it from but I can't find it right now and I'm in a
>  bit of a hurry. I'll follow up with the quote when I find it if someone
>  finds it appropriate.
>
>  The doubts that have rose since I tried using the lazy load are: What will
>  you get when calling ocm.getObject(path) on a path pointing to an object
>  with lazy loading collections? Will you get the object with it lists being
>  null?
no, a proxy is created and assign to the list. If you debug, you see it.

>How do you test if the collections have been really lazy loaded if by
>  calling the getter you make the collections be fetched from the repository?
>

we are using cglib. So, it is not difficult to implement. When a
method call is made on the collection attribute, the collection is
retrieved. See the java classes in
org.apache.jackrabbit.ocm.manager.objectconverter.impl

Hope this help. Let me know if you need more info.

Christophe