如何从 Nhibernate 会话中获取已更改(脏)实体的列表?
在刷新所有更改的实体之前,我需要编写一些业务逻辑。我尝试过的解决方案之一是IPreUpdateEventListener。但是这个事件监听器已经将对象非规范化为键值。在非规范化之前,甚至在刷新之前,我需要一些东西。
所以问题是如何获取已更改(脏)实体的列表。
I need to write some business logic rigt before flush against all changed entities. One of the solution I've tried is IPreUpdateEventListener. But this event listener already have object denormalized to key-value. I need something before denormalization and even before flush.
So the questions is how to get list of changed (diry) entities.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的检测脏实体的代码
My code to detect dirty entities
您可以查看 Flush 事件。但你到底想实现什么目标?
You might look at the Flush event. But what are you trying to accomplish, exactly?
嗯,我发现的最好的解决方案是使用 PersistenceContext。
但是,不确定这是否是正确的解决方案。
Well, best solution I've found is using PersistenceContext.
Not sure if this is right solution, however.