Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Lazy loading is not triggered in front-end, though static weaving is enabled
Lazy loading is not triggered in front-end, though static weaving is enabled [message #1707424] Fri, 04 September 2015 15:34 Go to next message
Stijn Hooft is currently offline Stijn HooftFriend
Messages: 2
Registered: September 2015
Junior Member
Hi,

When an entity has been passed to the front-end, and becomes detached, normally you cannot retrieve an unitialized, lazy-loaded list. Though, EclipseLink does support this feature, thanks to it's weaving.

We've used this feature heavily in our application, which was deployed on Weblogic.

Now, we are making the switch to JBoss EAP 6.3. Initializing uninitialized lists on detached entities no longer seem to work.

We've activated static weaving. (added the property in persistence.xml + added a maven plugin to do the weaving at compile time).
This seems to work fine.

When we start debugging, we see the following happen. The code here is the decompiled result after weaving:

Entity Organzation has a lazy-loaded list locations.
We call, on a detached Organization, the method getLocations():

@OneToMany(cascade={CascadeType.ALL}, mappedBy="organization")
    public List<OrganizationLocation> getLocations() {
        return this._persistence_get_locations();
    }



Organization => _persistence_get_locations()
public List _persistence_get_locations() {
        this._persistence_checkFetched("locations");
        return this.locations;
    }



AbstractDomainClass =>_persistence_check_fetched("locations")
public void _persistence_checkFetched(String string) {
        if (!this._persistence_isAttributeFetched(string)) {
            EntityManagerImpl.processUnfetchedAttribute((FetchGroupTracker)this, (String)string);
        }
    }



AbstractDomainClass => _persistence_isAttributeFetched("locations")
public boolean _persistence_isAttributeFetched(String string) {
        return this._persistence_fetchGroup == null || this._persistence_fetchGroup.containsAttributeInternal(string);
    }



Organization =>_persistence_fetchGroup == null is TRUE
AbstractDomainClass. _persistence_isAttributeFetched("locations") is TRUE
So nothing gets loaded!


Does anyone have any idea why _persistence_fetchGroup could be null? We don't have any fetchGroups specified, but it should have a default one, no?


We've tested this with EclipseLink 2.5.1, 2.5.2 and 2.6.0.
Re: Lazy loading is not triggered in front-end, though static weaving is enabled [message #1707591 is a reply to message #1707424] Mon, 07 September 2015 17:36 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Was the entity serialized somehow? Serialization can occur within the same JVM container and would prevent the entity from referencing the context it was read from to trigger unfetched relationships.
icon14.gif  Re: Lazy loading is not triggered in front-end, though static weaving is enabled [message #1707593 is a reply to message #1707591] Mon, 07 September 2015 17:49 Go to previous message
Stijn Hooft is currently offline Stijn HooftFriend
Messages: 2
Registered: September 2015
Junior Member
You are right. The EJB's themselves got serialized.
Instead of referencing to them with @EJB, they were put in a Spring Context and retrieved through the FacesContext instance. Getting rid of this strange construction and using local EJB's solved the problem.

EclipseLink is doing what was promised!

This thread can be closed.
Previous Topic:Getting a naming exception for a DataSource that I can find programatically
Next Topic:EclipseLink not using Tomcat JDBC Connection Pool?
Goto Forum:
  


Current Time: Sun Feb 25 17:46:01 GMT 2024

Powered by FUDForum. Page generated in 0.02402 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top