Reputation:
I want to tell hibernate to give me a callback notification when a new row is inserted into my database (this row is inserted by another system/application.)
Im using mysql cluster and replicates the databases within the cluster. As soon as some of the databases is changed the other systems must be informed about this change.
Is Hibernate supporting this kind of functionality? I assume I must have some kind of trigger or procedure on the database layer.
Upvotes: 4
Views: 1783
Reputation: 13124
As noted by tkopec, unless you have a way to have the database notify you (usually through some sort of network protocol) you would need to check the rows of the table in question at regular intervals. I do know that there are some modules available to do this for different databases, but I am not sure I can come up with a particular use case for it.
Upvotes: 0
Reputation: 12413
You can register interceptors to monitor operations done by your application. But not other modifications AFAIK. The only solution I can think of is some kind of polling your database. Unless your DB has some way of notifying you about changes. But it must be your database not Hibernate.
Upvotes: 5