sangi
sangi

Reputation: 531

Monitoring DB: MySQL

I am writing to ask for advice. I have to monitor certain "insert" on a mysql db. In what way is more convenient to do this? The application uses Servlets and MySQL. Thank you very much

Upvotes: 1

Views: 485

Answers (1)

BalusC
BalusC

Reputation: 1109735

Depends on the persistence framework you're using.

  • If it's Hibernate, you need to implement an Interceptor and hook on onSave().
  • If it's JPA, you need to use an entity method with the @PrePersist or @PostPersist annotation.
  • If it's plain vanilla JDBC, just add the code to the boilerplated DAO method.

This is unrelated to servlets. The servlet is just an API for intercepting on HTTP requests. Your data access layer should be independent and transparent from that.

Upvotes: 2

Related Questions