user1191027
user1191027

Reputation:

Java MySQL Event Listener

I'm trying to create a simple .java class that simply runs and listens/watches a bunch of tables in a MySQL schema for any CRUD changes. How could I go about doing this? Would Hibernate have something that I could use?

Upvotes: 0

Views: 1973

Answers (1)

polypiel
polypiel

Reputation: 2341

You can use a Hibernate Inceptor.

First implement the abstract class EmptyInterceptor. There are several methods to intercept, but for a CRUD I think you'll have to override onSave, onLoad and onDelete. Then register your interceptor on Hibernate configuration, method Configuration.setInterceptior

Upvotes: 0

Related Questions