Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 739 Bytes

DynamicUpdate.md

File metadata and controls

23 lines (17 loc) · 739 Bytes

@DynamicUpdate Annotation

Indicates that the annotated entity should use dynamic update behavior, where only modified fields are included in the SQL update statement.

Example usage:

            try (var bibernateSession = bibernateSessionFactory.openSession()) {
                //when
                var person = bibernateSession.findById(PersonWithoutDynamicUpdate.class, 1L).orElseThrow();
                firstName = person.getFirstName();
                lastName = person.getLastName();
                person.setFirstName(person.getFirstName() + uuid);
            }

Result of queries:

"SELECT * FROM persons WHERE id = ?;",
"UPDATE persons SET first_name = ?, last_name = ? WHERE id = ?;")