As explained in this forum thread, PostgreSQL provides the `NO KEYS` directive for pessimistic locking which allows child records that reference a parent row which was locked to be inserted.
To address this requirement, we have two options:
We could add a Hibernate configuration property which will allow Hibernate to use `KEY/NO KEY` when doing a PESSIMISTIC_READ or PESSIMISTIC_WRITE.
We could add a new LockOptions.NO_KEY for this purpose.
Using a Query Hint.