With https://hibernate.atlassian.net/browse/HHH-16281 the disassembling of OneToMany collections doesn’t work properly and renders the identifier object as a collection of objects ( instead of provided identifier type). Actually the identifier seems to be disassembled twice, first on NonAggregatedIdentifierMappingImpl.getIdentifier for the Entity object and secondly on AbstractEmbeddableMapping.dissamble of the identifier object. As result, an IllegalArgumentException is thrown when setting the identifier values: Caused by: org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [private java.lang.Long com.example.demo.domain.issue.DoubleId.id] by reflection for persistent property com.example.demo.domain.issue.DoubleId#id : [Ljava.lang.Object;@cc46555 {{ at app//org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:48)}} {{ at app//org.hibernate.metamodel.mapping.AttributeMapping.getValue(AttributeMapping.java:59)}} {{ at app//org.hibernate.metamodel.mapping.internal.AbstractEmbeddableMapping.breakDownJdbcValues(AbstractEmbeddableMapping.java:594)}} {{ at app//org.hibernate.metamodel.mapping.internal.NonAggregatedIdentifierMappingImpl.breakDownJdbcValues(NonAggregatedIdentifierMappingImpl.java:299)}} {{ at app//org.hibernate.metamodel.mapping.internal.OneToManyCollectionPart.breakDownJdbcValues(OneToManyCollectionPart.java:98)}} {{ at app//org.hibernate.metamodel.mapping.ModelPart.decompose(ModelPart.java:194)}} {{ at app//org.hibernate.persister.collection.OneToManyPersister.applyDeleteRowRestrictions(OneToManyPersister.java:640)}} {{ at app//org.hibernate.persister.collection.mutation.DeleteRowsCoordinatorStandard.deleteRows(DeleteRowsCoordinatorStandard.java:97)}} {{ at app//org.hibernate.persister.collection.OneToManyPersister.deleteRows(OneToManyPersister.java:194)}} {{ at app//org.hibernate.action.internal.CollectionUpdateAction.execute(CollectionUpdateAction.java:83)}} ... Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.example.demo.domain.issue.DoubleId.id to [Ljava.lang.Object; ... {{ at java.base/java.lang.reflect.Field.get(Field.java:425)}} {{ at org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:44)}} {{ ... 115 more}} My sample project uses Lombok / Spring Data.
- a Content class with inverse OnToMany reference:
- its composite ID class:
- a Detail class using a composite key defined with @IdClass:
- its composite key:
- the test that fails with the exception detailed above:
I have attached the tests logs. If needed, I can share my sample project. |