When I try to save entity with composite primary key Hibernate binds 5th parameter while I have only 4.
Steps to reproduce:
This is the trouble entity:
The other related entities:
This is the way I put AssetAssetTypeAttribute in Asset Entity
This is the way I save entities:
When Hibernate tries to save AssetAssetTypeAttribute entity, it generate this stuff:
And therefore I got this exception on the Postgresql level:
Entities are successfully saved
And I created pull request with test.
In test I get error Invalid value "5" for parameter "parameterIndex".
And you have a broken link in README.md here
Thanks for the test. I will give it a look later today.
Noticed that I accidentaly added redundant @Id annotations in test while trying to see behavior. Already removed them from tests and from description.
The strange behavior is still reproducing
Seems like I found workaround with @Embeddable annotation. Maybe it is more elegant solution for my case. And while debugging I noticed that hibernate ignores “insertable” parameter for column with @Id annotation. It tries to bind all @Id values.
So, workaround itself: