File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes problem with Hibernate interceptor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "problem with Hibernate interceptor" Watch "problem with Hibernate interceptor" New topic
Author

problem with Hibernate interceptor

Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
I have a simple Hibernate Interceptor where I override the methods

onFlushDirty and
onSave

In this method i set the last modified date / last modified by / created date/created by on the POJOs. I see that Hibernate does call this interceptor when i do HibernateTemplate.save / HibernateTemplate.update.

The POJO's 'lastmodifieddate' and the 'lastmodifiedby' fields do get updated in the interceptor and i return 'true' from onFlushDirty and onSave methods.

But when hibernate subsequently flushes the SQL to the DB, these fields turn out to be null( The update SQL trace shows null as the value for the 'lastmodifieddate' and the 'lastmodifiedby' fields)

I also observed that the object being supplied to the interceptor is same as the one supplied to HibernateTemplate.save / update.

Any idea what might be going wrong here?
 
 
subject: problem with Hibernate interceptor
 
Threads others viewed
Timestamping in Hibernate
how to insert a current date into the databse colunm using hybernate ?
error onclick of radio button inside display tag
Association references unmapped class exception with hibernate
Hibernate Search in Action: What do you mean by Search exactly?
MyEclipse, The Clear Choice