I am trying to audit database operations by implementing hibernate interceptor. Most of the things work fine, however the problem is with logging composite objects.
And there are some related questions -
1. Hibernate interceptor enables me to log the class names, how do I get the corresponding table names ?
2. Consider a class -
Code:
Book {
id,
publisher,
pages,
cost,
List<Author> authors.
....
....
}
When I make a call to session.save(book), it makes two insert queries on is in the Book table and the other one in the BookAuthormap table. The interceptor, seems to intercept only the save call for the book. I never get to intercept the save on BookAuthormap table.
How do I do that ? What is the standard practice of auditing database - ignore the map ?