监控数据库:MySQL

发布于 2024-09-07 20:46:39 字数 86 浏览 2 评论 0原文

我写信寻求建议。 我必须监视 mysql 数据库上的某些“插入”。 用什么方式来做这个比较方便呢? 该应用程序使用 Servlet 和 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云淡月浅 2024-09-14 20:46:39

取决于您使用的持久性框架。

这与 servlet 无关。 Servlet 只是一个用于拦截 HTTP 请求的 API。您的数据访问层应该独立且透明。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文