Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » PreUpdate not working(PreUpdate not working on persist with cascade)
PreUpdate not working [message #523923] Mon, 29 March 2010 16:46 Go to next message
Eclipse UserFriend
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 17:55 Go to previous messageGo to next message
Eclipse UserFriend
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 17:57] by Moderator

Re: PreUpdate not working [message #524575 is a reply to message #523923] Thu, 01 April 2010 09:25 Go to previous message
Eclipse UserFriend
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?

Previous Topic:coalesce in where clause results in timeout
Next Topic:Stored Procedure call - Autocommit behavior
Goto Forum:
  


Current Time: Tue Jul 08 23:18:15 EDT 2025

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

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

Back to the top