-
1. Re: Configure lazy loading in an envers query
adamw Sep 27, 2011 2:18 PM (in response to desol4tion)Hmm all relations are lazy in Envers, even if they are marked as eager in the class. Are you sure you are not accessing the relations and causing them to be loaded?
Adam
-
2. Re: Configure lazy loading in an envers query
tychinasg Dec 13, 2011 1:02 PM (in response to adamw)I don't know shold I create a new discussion or not but anyway. Could relations be non-lazy in envers (some configuration etc.)?
Thanks,
Sergey.
-
3. Re: Configure lazy loading in an envers query
adamw Dec 17, 2011 6:57 AM (in response to tychinasg)Nope, only lazy currently unfortunately.
Adam
-
4. Re: Configure lazy loading in an envers query
ndtreviv Jul 24, 2012 10:40 AM (in response to adamw)We're in a situation where we're using abstract classes and need to cast to implementations in some areas. Unfortunately, Hibernate's lazy loading doesn't do a great job of proxying abstract classes (ie: it doesn't let you cast to the Impl). This is mostly not an issue because we're not using lazy loading that often in the application. However, envers uses it EVERYWHERE.
We really need envers to support eager loading of objects. Is there a technical reason why this cannot be done?
-
5. Re: Configure lazy loading in an envers query
adamw Aug 7, 2012 8:10 AM (in response to ndtreviv)Well, the queries would get pretty complex to fetch a tree - as the depth may be arbitrary.
Adam
-
6. Re: Configure lazy loading in an envers query
wgorder Aug 17, 2013 5:19 PM (in response to adamw)Is this also true when using the ValidityAuditStrategy? This lazy loading thing is biting me pretty good in my current project where there are lots of reads and traversals of the audited data. I am thinking of doing what was suggested in this post. http://stackoverflow.com/questions/7572613/envers-query-returns-a-lazy-result-instead-of-an-eager-one
and mapping the audit tables to regular Entities. I think that the queries are going to look much the same as the table structure really does not change at all when using the validity strategy. Let me also say that this is an awesome framework overall, and has saved me a ton of time on my current project despite this one short coming, but it would be great if some day it were supported.
Thanks,
-
7. Re: Configure lazy loading in an envers query
marx3 Oct 21, 2013 4:33 AM (in response to wgorder)How would you map audit tables to entities? I've tried to do that. I've added entity which extends my original entity and adds missing fields like revision etc, and map it to table xxx_aud. Hovewer after deploy Hibernate complains about duplicate use of xxx_aud table. So it seems Envers somewhat internally create such entities during startup(?).