开发者

Monitoring DB: MySQL

I am writing to ask for advice. I 开发者_如何学Chave 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜