views:

29

answers:

2

Hi,
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

+1  A: 

You could create triggers to accomplish this as part of your schema generation using the database-object mapping.

DanP
A: 

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?

hvgotcodes
The Event Architecture is what I was looking for! Thanks!