ElementCollection with MapKeyColumn and Embeddable value represents empty rows as null values

Description

My test case is here:
https://github.com/moodysalem/hibernate-tests/blob/master/src/test/java/Tests.java#L50

I have a competition with this map of an embeddable entity

Here is the embedded entity

I don't care whether the fetch from the database represents an empty Participant as NULL or an object with null values, but when later saving changes to this entity, if there is a unique constraint on Side and Competition ID (one participant per side), we get an error because the generated SQL attempts to insert for that side rather than UPDATE.

Environment

hibernate-core 5.2.5, h2 and mysql

Activity

Show:
Moody Salem
December 22, 2016, 4:36 PM

I had to write this workaround to NULL out any values where all the fields were null, but bad data in the database can still cause the issue

Moody Salem
April 24, 2017, 9:48 PM

this is loosely caused by the inability of hibernate to know that the competition has a participant because the participant row has all null values

Gail Badner
July 28, 2017, 6:36 PM

Please see HHH-11883.

Assignee

Gail Badner

Reporter

Moody Salem

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure