如何在休眠中实现触发器 [英] How to implement triggers in hibernate
本文介绍了如何在休眠中实现触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在休眠中实现类似于触发器的东西.
I want to implement something similar to triggers in hibernate.
我需要的是当表中的列达到特定值时,应将行插入另一个表或应更新其他表.
What I need is when a column in a table attains a specific value, a row should be inserted in another table or some other table should be updated.
我如何在 hibernate 中实现这一点?
How do I implement this in hibernate ?
推荐答案
这在 第 14 章拦截器和事件.
例如,您可以拦截更新后事件.
You can, for example, intercept a post-update event.
然而,将事件系统用于业务操作可能不是最好的主意(它们最适合用于基础设施问题).您应该为此使用更高级别的层.
However, using the event system for business operations might not be the best idea (they are best used for infrastructure concerns). You should use a higher level layer for that.
这篇关于如何在休眠中实现触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文