如何使用 iBATIS 实现审计拦截器?

发布于 2024-07-21 05:35:39 字数 240 浏览 2 评论 0原文

我想使用名为 AuditEvent 的表来记录数据库中的所有更改,该表存储修改的行 ID(主键)、表名、列名、先前值、新值、更改日期(时间戳)、操作类型(插入/更新/删除)以及进行更改的用户的名称。

我正在使用 SQL Server 2005,但我不想使用触发器,因为由于我使用连接池,因此很难找到当前用户。

基于拦截器的 Hibernate 解决方案非常简单。 使用 iBATIS / iBATOR 时如何做类似的事情?

I want to log all changes in my database for auditing purposes, using a table called AuditEvent that stores the modified row ID (primary key), table name, column name, previous value, new value, date of change (timestamp), operation type (insert / update / delete) and the name of the user who did the changes.

I'm using SQL Server 2005, but I don't want to use triggers, because since I use a connection pool it would be difficult to find the current user.

The Hibernate solution based on an Interceptor is pretty simple. How do I do something similar when using iBATIS / iBATOR ?

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

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

发布评论

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

评论(1

少女净妖师 2024-07-28 05:35:39

如果您使用的是 Spring,则可以使用 SqlMapClientDaoSupport 来编写模板 Dao 对象,这些对象将审计与您正在使用的任何事务支持结合起来。 如果没有,有一个 iBatis Doa 模板选项,即 iBatis DAO。 这已经被贬值了,所以 Spring 可能会更好。

If you're using spring, you might be able to use SqlMapClientDaoSupport to write template Dao objects that wrap auditing up with whatever transaction support you are using. If not, there is an iBatis Doa template option, iBatis DAO. That has been depreciated so you might be better off with Spring.

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