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 :
Linux, openjdk version "11.0.4" 2019-07-16, Ubuntu 4.15.0-55-generic, MariaB / H2
I added a small maven project which reproduces the issue. Simply package and execute:
, 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?
The following command extracts the archive correctly:
$ tar xvf hibernate-bug-elementcollection.tar.gz
I also attached the same project as a zip archive.