skyman
skyman

Reputation: 2335

Is there a code level approach to triggers with JPA

We have a moderate size Spring data / JPA application with around 100 tables. We have been fairly strict about design leaving the RDBMS to do what it is good at; persistence and maintaining all program logic at the code level. We now need to extend the application so that events can be triggered in a systematic way from RDBMS inserts and updates. We could potentially achieve this with database triggers calling programmatic methods, however we would like to keep the trigger functionality at the application level if possible. Is there a systematic approach to achieving this with JPA?

Upvotes: 1

Views: 747

Answers (1)

shazin
shazin

Reputation: 21883

If you are using Hibernate with spring-data-jpa you can easily register listeners to achieve application level triggers on inserts and updates. Check this post.

I am sure other ORM framework's also provide something similar.

Upvotes: 3

Related Questions