@lob lazyness

258 views
Skip to first unread message

Hielke Hoeve

unread,
Sep 30, 2009, 4:35:55 AM9/30/09
to Ebean ORM
Hi,

I am considering using Ebean for my next project instead of the oh so
great Hibernate (not!), one of the greatest problems I have is that
fields with @Lob do not seem to be lazy at all. So when lazy loading a
bunch of objects with a @Lob field the memory usage is unbelievable.
Which means creating an extra manytoone just to avoid this.

Is Ebean smart enough to lazy load an @Lob?

Rob Bygrave

unread,
Sep 30, 2009, 5:37:17 AM9/30/09
to eb...@googlegroups.com
Good question.

Several answers:

1. Partial object queries
2. Autofetch
3. This is a bug really - ignoring the fetch lazy annotation


1. Partial object queries
---------------------
With ebean you can specify which properties you want to fetch and exclude the Lob field (or whatever fields).

// explicitly specify the properties you want - aka "Partial Object" query
find order (id, status)
join details (quantity, price)
where ...


2. Autofetch
---------------------
I use Autofetch a lot and so it will exclude all the properties I don't use automatically for me. Nice but not for everyone and you can't use it in every situation.



3. This is a bug really - ignoring the fetch lazy annotation
---------------------
I think this is really a bug (oversight).  That is, if you don't explicitly specify your properties via partial object query or use Autofetch then Ebean should be smart and honor the JPA Lazy loading annotations.

Right now, Ebean doesn't do that ... so I'll go and log that as a bug.   
Logged as http://www.avaje.org/bugdetail-161.html



Cheers, Rob.

Rob Bygrave

unread,
Oct 29, 2009, 4:27:41 AM10/29/09
to Ebean ORM

FYI: This was fixed as Bug 161 which is now fixed in HEAD (and
included in the next release).

http://www.avaje.org/bugdetail-161.html
> Logged ashttp://www.avaje.org/bugdetail-161.html
>
> Cheers, Rob.

Hielke Hoeve

unread,
Oct 30, 2009, 10:18:09 AM10/30/09
to Ebean ORM
whoot thanks!
Reply all
Reply to author
Forward
0 new messages