Is there an Annotation for method, to work as a trigger in Java Spring?

Viewed 167

I would like to execute certain method every time a specific Entity is persisted. This method should perform some kind of checking on entity object, so its need a access to this specific object.

Is there an Annotation, or other method allowing me to do so? Basically, it should be working like some kind of trigger.

3 Answers

You could consider using entity validation annotations directly on your entity objects, e.g. hibernate entity annotations. If you register your entity validator, these can be called automatically prior to entity save.

does after point cut of spring aop can solve your problem?

Related