Invalid statement generated for @MapKeyColumn(updatable=false) for @OneToMany

Description

I am using @MapKeyColumn(name = "mapkeycolumn", updatable = false) together with @OneToMany. The "updatable = false" leads to the "mapkeycolumn" not being set in the generated sql "update xxx set mapkeycolumn=? where id=?". The JDBC driver throws an error because of the two parameters just one has been set.

This bug has been introduced after Hibernate 5.1.0, which works fine with the very same code.

The OneToManyPersister is configured correctly, having a false at the correct position in the "indexColumnIsSettable" array. In my opinion the update statement should not be issued at all in this case. Offending code: OneToManyPersister#writeIndex(PersistentCollection, Iterator, Serializable, boolean, SharedSessionContractImplementor).

Environment

Postgresql

Status

Assignee

Gail Badner

Reporter

Markus Heiden

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.2

Priority

Major
Configure