unable to get lazy loading to work [message #505774] |
Mon, 04 January 2010 16:37  |
Eclipse User |
|
|
|
we are trying to get lazy loading to work, using this environment:
spring 2.5.6
eclipselink 2.0
maven 2.2.1
tomcat 5.5 (or tomcat6)
mysql 5.0.83
from one of the tutorials on eclipselink, we learned that dynamic weaving is not available in tomcat. ok. static weaving it is then.
we learned from this article ( http:// www.tzavellas.com/techblog/2008/10/17/statically-weaving-jpa -entities-for-eclipselink-using-maven/ ) how to statically weave our jpa entities.
when maven runs, it looks like static weaving is happening, for example, we see output like this:
[java] [EL Finest]: 2010-01-04 13:40:04.765--ServerSession(18378667)--Thread(Thread[main,5, main])--Begin weaver class transformer proce
ssing class [com/aftama/core/db/entity/Tenant].
[java] [EL Finest]: 2010-01-04 13:40:04.781--ServerSession(18378667)--Thread(Thread[main,5, main])--Weaved fetch groups (FetchGroupTrack
er) [com/aftama/core/db/entity/Tenant].
[java] [EL Finest]: 2010-01-04 13:40:04.781--ServerSession(18378667)--Thread(Thread[main,5, main])--End weaver class transformer process
ing class [com/aftama/core/db/entity/Tenant].
In the Tenant entity, shown in the above log output, we have one-to-many relationships defined like so:
@OneToMany(mappedBy = "tenant", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<MediaCategory> mediaCategories = new ArrayList<MediaCategory>();
we have this line in our persistence.xml:
<property name="eclipselink.weaving" value="static" />
when we invoke a service call to fetch a Tenant (from a flex/blazeds UI to tomcat), it eagerly fetches the oneToMany collection, described above. we are expecting it not to fetch it, so that when we get the Tenant object back, the collection is null or empty.
we tried this in tomcat5 and tomcat6, with the same result: the oneToMany collection is fetched rather than not fetched.
what are we missing? how do we get lazy loading to work in this environment?
|
|
|
|
|
Re: unable to get lazy loading to work [message #538316 is a reply to message #505774] |
Mon, 07 June 2010 06:36  |
Eclipse User |
|
|
|
I need a big help to solve this huge performance issue .
Project description
use eclipseLink JPA 2.0
spring 3.0.1 web 3.0.2 security
front end flex
spring blazeDS Integration
Issue
When I call to one spring service from client flex app,
JPA will loading the table that I need and all the tables that have relations to the table even I have declared it JPA lazy loading also.
|
|
|
Powered by
FUDForum. Page generated in 0.03787 seconds