Sleeping interceptor message save?

I need to intercept post save for an entity in sleep mode, but all I found was in save, which deals with the entity before saving, and there is a postFlush method that returns a huge lazy iterator, t understand how to use it, please offer me a way to catch an object after saving or updating hibernate,

Hi,

+3
source share
3 answers

postFlush is what you want. An iterator will allow you to go through all the objects that have been inserted or updated. It is called after sql has executed in the database.

+5
source

Try the javax.persistance.PostPersist annotation:

@PostPersist
private void postPersist()
{
    // do stuff
}
+2

Source: https://habr.com/ru/post/1762602/


All Articles