如何在hibernate中实现触发器 [英] How to implement triggers in hibernate
本文介绍了如何在hibernate中实现触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在hibernate中实现类似于触发器的东西。
我需要的是,当一个表中的某列获得特定值时,应该在另一个表中插入一行或者应该更新其他表。
如何在hibernate中实现这个功能?
解决方案
例如,您可以拦截更新后的事件。
然而,使用事件系统 business 操作可能不是最好的想法(它们最适合用于基础设施问题)。你应该使用更高层次的图层。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.
How do I implement this in hibernate ?
解决方案
That's described in Chapter 14. Interceptors and events.
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.
这篇关于如何在hibernate中实现触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文