Is there a way to get only changed columns from an object using Hibernate?

In a permanent object, if I change only one field, is it possible to recognize the changed field only through Hibernate? I know that I can get the whole old line and new line and compare.

+3
source share
2 answers

One option is to connect to the Hibernate event system (see docs ). For example, if you registered to receive FlushEntityEvent, you should be informed about which columns were changed using the getDirtyPropertiesevent method .

+5
source

, , , Envers .

Envers / . , , , , @Audited. , , . .

+7

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


All Articles