vjhiber wrote:
Here is what I am trying to do.
Lets say application code does following
/*** application code begins ***/
session.beginTransaction();
myDAO.saveSomething(myPesistentObj);
yourDAO.saveSomethingElse(yourPesistentObj);
// I would like to have some object in run time, where I can store information
// like USER NAME, TRANSACTION ID, SOME OTHER INFO
/ This information later should be accessible by hibernate interceptor
session.endTransaction();
/*** application code ends **/
I have written a interceptor modeled after Audit Log example on hibernate site. Hibernate Interceptor code has following method
public void postFlush(Iterator iterator) {
// Here BEFORE INSERTING THE LOG RECORD I WOULD LIKE
// to access the information I had stored in some object while
// executing above application code.
for (Iterator itr = inserts.iterator(); itr.hasNext();) {
LogRecord logRecord = (LogRecord) itr.next();
session.save(logRecord);
}
}
well you can also extend the session class and can provied you specific implementation there also