0

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?

1
  • 1
    I would use a trigger that calls out to a UDF to invoke a web service in your Java app. This essentially would act as MySQL publishing the event to Java so that you do not need to poll. The solution is a little more flushed out here: stackoverflow.com/questions/11127943/… Commented Jan 7, 2014 at 21:09

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.