Merge of an Entity with an immutable composite user type throws Exception

Description

Regression on 5.6.11 when using a column referencing a composite user type which is immutable.

Caused by changes to https://hibernate.atlassian.net/browse/HHH-15359#icft=HHH-15359 in particular https://github.com/hibernate/hibernate-orm/commit/fd3ab8b7cfb21f7fd14e628f6f33ed532757836a#diff-3c65a34844742881c48196badd6f79bd00e6d45161a11dbc0868a2e0c134157cR260 fails to work with a custom/composite user type which is immutable (ref. CompositeUserType#isMutable) and therefore doesn't support CompositeUserType#setPropertyValue.

Might be necessary to adapt the check in TypeHelper#replaceAssociations to assure the type is mutable before trying to manipulate it:

TypeHelper.java

if ( componentType.isMutable() && target[i] != null && objects != null ) { // Need to account for entity mode on the CompositeType interface, that seems not been used by any implementation componentType.setPropertyValues( target[i], objects, EntityMode.POJO ); }

Activity

Show:

Fabien Thouny November 3, 2022 at 9:37 PM

Thank you 🙂

Sanne Grinovero November 3, 2022 at 9:30 PM

we’re releasing 5.6.13.Final today 😉

Fabien Thouny November 3, 2022 at 6:26 PM

Hi @Andrea Boriero !

I just hit this bug while upgrading to Spring Boot 2.7 which uses Hibernate ORM 5.6.12.

I want to know if the 5.6.13 release is planned anytime soon ? I could also downgrade to 5.6.10 in the meantime but would not benefit from the bugfixes in 5.6.11 & 5.6.12.

Thanks !

Andrea Boriero September 27, 2022 at 11:53 AM

Thanks

CT September 27, 2022 at 11:17 AM

@Andrea Boriero

Yes please find it as second commit here: https://github.com/hibernate/hibernate-orm/compare/5.6...ctvairplus:hibernate-orm:HHH-15554

I extended the existing CompositeUserTypeTest with a testcase.

Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created September 26, 2022 at 4:38 PM
Updated November 3, 2022 at 9:37 PM
Resolved October 4, 2022 at 10:18 AM