@postload problem : never called [message #650517] |
Tue, 25 January 2011 06:56  |
Eclipse User |
|
|
|
hi all,
I have a problem with the annotation @postload: it is never called. !!
(I use the last official version of eclipselink and the problem already exist in the version before)
So I use @EntityListeners instead , and I implement "DescriptorEventListener" as:
public class LocationListener implements DescriptorEventListener {
public void postBuild(DescriptorEvent arg0) {
Location l = (Location) arg0.getSource();
try {
Tools.convertLocation(l);
} catch (Exception e) {
l.setName("Error " + e.getMessage());
}
}
But , sometime, the postBuild is not called too.
So it is a real problem.
Any idea ?
Thanks
|
|
|
Re: @postload problem : never called [message #650728 is a reply to message #650517] |
Wed, 26 January 2011 05:02   |
Eclipse User |
|
|
|
About why sometime the postBuild is not called , I find this :
when the expiry time is passed, (so the cache is expired) , eclipse link does not call the postBuild of the entityListener.
Here is the object ;
Entity
@Table(catalog = "sdcarbrp", schema = "dbo", name = "v_car_list_location")
@EntityListeners( { LocationListener.class })
@Cache(type = CacheType.FULL, expiry = 3600000, shared = true)
public class Location implements Serializable, Comparable<Location> {
.....
So, in this example, after 1 hour, the postBuild methode will not be call by the listener.
I think it is a bug of eclipse link.
About why eclipselink never call the @postLoad : no idea for tjhe moment.
[Updated on: Wed, 26 January 2011 05:05] by Moderator
|
|
|
Re: @postload problem : never called [message #650832 is a reply to message #650728] |
Wed, 26 January 2011 13:21  |
Eclipse User |
|
|
|
Hello,
Sounds like you are seeing bug 273304 https://bugs.eclipse.org/bugs/show_bug.cgi?id=273304
This occurs when EclipseLink builds the object in the shared cache and then merges them into the managed entity. Is it that the postLoad is not called at all, or that it is called on the wrong entity (the object built for the shared cache)? You might try the workaround which is to also use the postMerge event as well as the postRefresh.
As for postBuild, it is specifically for when the object is built into the cache. If the object is invalid but still exists in the cache, it will not be fired, as this is a refresh event.
Best Regards,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.04897 seconds