Hibernate and Event based Interaction
For my persistence framework I am using Hibernate. What I would like to do is the following:
Whenever a new row in inserted (or value of a column changed) in a specific DB table, I would like Hibernate to call a specific procedure?
How do I handle this开发者_高级运维 in Hibernate?
Thanks, Neel
You could create triggers to accomplish this as part of your schema generation using the database-object mapping.
You can use hibernate events.
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/events.html
you can also configure you DBMS to do this, although you would have to ask your DB admin how to do this.
The question is, do you want to handle it programmatically within your application, or just have your DB do it for you. I think the latter is better.
edit -- it depends what you mean by 'procedure'...like a procedure that you write in your application or a stored procedure?
精彩评论