OptimisticLockException on wrong update query with PgSQL

Description

Hello. It`s small, but very confusing bug. I have 1 entity class with PK. In code i create new entity, but not save it to database (my bug). After that i make some entity changes and try to update it. I think entity already saved, but not. Hibernate generate update query with "where id=null" and PgSQL return 0 updated rows. By this condition, Hibernate throws:

Exception class very confusing, I some time search reason of lock. Only after deep debugging i found wrong update query with id=null.

Environment

Java 8

Assignee

Unassigned

Reporter

Антон Кузьмин

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.2.10

Affects versions

Priority

Minor
Configure