Parameter binding mismatch on insert when an @ElementCollection @MapKeyColumn uses a declared field of an @Embeddable value

Description

Considering the following mapping involving an @Entity with an @ElementCollection of type Map with @Embeddable as value and a declared column of this @Embeddable as Key:

When adding a new "State" class to the Map then Flushing, the number of parameters in the SQL insert
statement does not matches the number of bind parameters. There is one extra
parameter set to null value, which makes the underlaying driver to trigger an
exception (see log below). This has been tested with MariaDB and H2.

Here the test code:

and the output exception :

Environment

Linux, openjdk version "11.0.4" 2019-07-16, Ubuntu 4.15.0-55-generic, MariaB / H2

Activity

Show:
Benjamin Legendre
August 5, 2019, 3:47 PM

I added a small maven project which reproduces the issue. Simply package and execute:

 

 

Gail Badner
August 5, 2019, 11:15 PM

, I think there's a problem with your mapping.

I'm not able to extract your attachment:

$ tar xzf hibernate-bug-elementcollection.tar.gz

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

How do I extract it?

Benjamin Legendre
August 6, 2019, 7:49 AM

Hi Gail,

The following command extracts the archive correctly:

$ tar xvf hibernate-bug-elementcollection.tar.gz

I also attached the same project as a zip archive.

 

Assignee

Unassigned

Reporter

Benjamin Legendre

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2019/08/05

Feedback Requested By

Gail Badner

Components

Affects versions

Priority

Major
Configure