Spring jpa, how to generate event on insert?

440 Views Asked by At

I have an application and it is deployed on four different container (jboss eap 6.2). I want that: when an instance of this application do an insert on a specific table all other applications should notify this insert to all connected user. I prefer to avoid direct connection from instance (ejb for example). It's possible using Spring data to osservare a table and to generate an event when someone do a insert? I need something like trigger? Can I have a equivalent full write java?. (DBMS: Oracle 12c)

1

There are 1 best solutions below

0
On BEST ANSWER

Spring data itself does not have a mechanism to be notified of inserts made by another process to a database.

You need either a trigger on the database as you suggest, or a distributed event / caching framework, e.g. ehcache, whereby the container doing the insert would notify all the other containers of the insert.