• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

problem with Hibernate interceptor

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic