Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » PreUpdate not working(PreUpdate not working on persist with cascade)
PreUpdate not working [message #523923] Mon, 29 March 2010 20:46 Go to next message
Shumy Missing name is currently offline Shumy Missing name
Messages: 18
Registered: March 2010
Location: Aveiro, Portugal
Junior Member
I am using EclipseLink 1.1.3 and I need to use the PreUpdate callback.

I have a relation @ManyToOne from the "User" to the "HasAudit".
I am using the @EntityListeners(AuditListener.class) in the HasAudit class.
In the "AuditListener" I have the @PrePersist, @PreUpdate callbacks, and also have the "cascade=ALL" configuration from "User" to "HasAudit".

The @PrePersist method is working fine, but the @PreUpdate method is never called.

How can I solve this?
Re: PreUpdate not working [message #523937 is a reply to message #523923] Mon, 29 March 2010 21:55 Go to previous messageGo to next message
Shumy Missing name is currently offline Shumy Missing name
Messages: 18
Registered: March 2010
Location: Aveiro, Portugal
Junior Member
I also detected something else.
I have raise the level of logging to "ALL", detected that forcing a persistence instead of relying on cascade does not work.
The logs:

AUDIT UPDATE
[EL Finest]: 2010-03-29 22:49:49.722--UnitOfWork(29408998)--Thread(Thread[http-8080- 3,5,main])--PERSIST operation called on: gvl.domain.impl.base.Audit@e920f.
[EL Finest]: 2010-03-29 22:49:49.722--UnitOfWork(29408998)--Thread(Thread[http-8080- 3,5,main])--assign sequence to the object (5 -> gvl.domain.impl.base.Audit@e920f)
[EL Fine]: 2010-03-29 22:49:49.725--ClientSession(305514)--Connection(9423995)--Th read(Thread[http-8080-3,5,main])--UPDATE gvl_user SET NAME = ? WHERE (ID = ?)
bind => [Micael Pedrosa, 1]
[EL Finer]: 2010-03-29 22:49:49.731--ClientSession(305514)--Connection(9423995)--Th read(Thread[http-8080-3,5,main])--commit transaction
[EL Finer]: 2010-03-29 22:49:49.733--UnitOfWork(29408998)--Thread(Thread[http-8080- 3,5,main])--end unit of work commit
[EL Finer]: 2010-03-29 22:49:49.733--UnitOfWork(29408998)--Thread(Thread[http-8080- 3,5,main])--resume unit of work

It's visable that the PERSIST operation is called on "Audit" but the SQL to INSERT is never generated.
This works fine on OpenJPA.



[Updated on: Mon, 29 March 2010 21:57]

Report message to a moderator

Re: PreUpdate not working [message #524575 is a reply to message #523923] Thu, 01 April 2010 13:25 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You should see more than this logged on ALL, you should also see the query execution logged and registration. Can you include the complete log for the whole process. Maybe set level to FINEST, although ALL should include everything.

Also include the code for the two classes and the code for the event listener and how you are persisting the objects.

Do you have any existing data in the cache or database that may be conflicting with the Aduti's id?



James : Wiki : Book : Blog : Twitter
Previous Topic:coalesce in where clause results in timeout
Next Topic:Stored Procedure call - Autocommit behavior
Goto Forum:
  


Current Time: Wed Oct 22 04:57:45 GMT 2014

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

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