# Hibernate 6 upgrade causes nullpointerException

**URL:** <https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780>\
**Category:** Hibernate ORM\
**Created:** [January 2, 2024, 7:57am UTC](https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780 "2024-01-02T07:57:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ygoogwle](https://avatars.discourse-cdn.com/v4/letter/y/f19dbf/32.png) [@ygoogwle](https://discourse.hibernate.org/u/ygoogwle)\
**Post date:** [January 2, 2024, 7:57am UTC](https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780/1 "2024-01-02T07:57:36Z")

</div>

After upgrading the hibernate from 6.1.7 to 6.3.1 Final version, we get nullpointer exception while trying to persist OnetoMany mapping entity.

```auto
java.lang.NullPointerException: Cannot invoke "org.hibernate.sql.model.PreparableMutationOperation.canBeBatched(org.hibernate.engine.jdbc.batch.spi.BatchKey, int)" because "jdbcOperation" is null
	at org.hibernate.engine.jdbc.mutation.internal.StandardMutationExecutorService.createExecutor(StandardMutationExecutorService.java:77) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.persister.collection.OneToManyPersister.writeIndex(OneToManyPersister.java:229) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.persister.collection.OneToManyPersister.recreate(OneToManyPersister.java:177) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:47) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:631) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:498) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:363) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1415) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]
	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1401) ~[hibernate-core-6.3.1.Final.jar:6.3.1.Final]

```

We are having oneToMany mapping with map in the entity.

```auto
<class name="com.demo.dao.model.UserSubstituteEntity" table="demo_user_substitute">
        <composite-id name="id" class="com.demo.datatypes.identifier.GUID">
            <key-property name="id" type="string" column="USER_SUBSTITUTES_ID" />
        </composite-id>
        <property name="fromDate" column="FROM_DATE" />
        <property name="toDate" column="TO_DATE" />
        <property name="active" not-null="true" column="ACTIVE" />
        <one-to-one name="userAccount" property-ref="userSubstitutes" class="com.demo.dao.model.AccountUserEntity" foreign-key="FK_DEMO_SUBST_USR_ACC" fetch="join"/>

        <map name="substitutes" cascade="all-delete-orphan" inverse="true" fetch="join">
            <key foreign-key="FK_DEMO_SUST_DEMO_USR_SUBST">
                <column name="DEMO_USER_SUBSTITUTE_ID" unique-key="UN_USER_SUBST_KEY" />
            </key>
            <composite-map-key class="com.demo.UMObjectDescription">
                <key-property name="UMObjectId">
                    <column name="UM_OBJ_ID" unique-key="UN_USER_SUBST_KEY" />
                </key-property>
                <key-property name="internalObjectType" >
                    <column name="UM_OBJ_TYPE" unique-key="UN_USER_SUBST_KEY" />
                </key-property>
            </composite-map-key>
            <one-to-many class="com.demo.dao.model.SubstituteEntity"/>
        </map>
</class>

<class name="com.demo.dao.model.SubstituteEntity" table="demo_substitute">
        <composite-id name="id"
                      class="com.demo.datatypes.identifier.GUID">
            <key-property name="id" type="string" column="USER_SUBSTITUTE_ID" />
        </composite-id>
        <component name="substitutionFor">
            <property name="internalObjectType" column="UM_OBJ_TYPE" />
            <property name="UMObjectId" column="UM_OBJ_ID" />
        </component>
        <bag name="substitutionGroups" table="demo_subst_substitution_grps" cascade="all-delete-orphan" fetch="join">
            <key column="USER_SUBSTITUTE_ID" foreign-key="FK_DEMO_SBST_GRPS_DEMO_SBST"/>
            <many-to-many column="PG_ID" class="com.demo.dao.model.ASubstitutionGroupPersistentEntity" foreign-key="FK_DEMO_SUBSGRP_DEMO_SUBS"/>
        </bag>
        <many-to-one
                name="userSubstitute"
                class="com.demo.dao.model.UserSubstituteEntity"
                column="DEMO_USER_SUBSTITUTE_ID"
                not-null="true"
                cascade="all"
                foreign-key="FK_DEMO_SUBST_DEMO_USR_SUBST"
                fetch="join"
        />
    </class>

```

This null pointer occurs in the place of OneToManyPersister.java class as present in the screenshot below. This object **updateRowOperation** is null for this property UserSubstituteEntity.substitutes.

 ![nullpointer](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/5/565269a77d923e9bb1b6c059305c6e77cd6e2c85.png)

Is this an issue in hibernate or do we need to adapt something in the configuration mapping ?

---

<div class="post-metadata">

**Author:** ![mbladel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mbladel/32/2128_2.png) [@mbladel](https://discourse.hibernate.org/u/mbladel)\
**Post date:** [January 2, 2024, 11:04am UTC](https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780/2 "2024-01-02T11:04:06Z")

</div>

Hello, Hibernate 6.3.1 is [no longer supported](https://hibernate.org/orm/releases/6.3/). Please update to the [latest supported version](https://hibernate.org/orm/releases/) and if the error persists create an issue in the [issue tracker](https://hibernate.atlassian.net) with a [test case](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) that reproduces the issue.

---

<div class="post-metadata">

**Author:** ![Ilia\_Basin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ilia_basin/32/2425_2.png) [@Ilia\_Basin](https://discourse.hibernate.org/u/Ilia_Basin)\
**Post date:** [December 12, 2024, 10:42am UTC](https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780/3 "2024-12-12T10:42:05Z")

</div>

Thanks. Downgrading from 6.6.3.Final to 6.1.7.Final helped me solve an error with the same stacktrace. Did you find a better solution?

---

<div class="post-metadata">

**Author:** ![Ilia\_Basin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ilia_basin/32/2425_2.png) [@Ilia\_Basin](https://discourse.hibernate.org/u/Ilia_Basin)\
**Post date:** [December 15, 2024, 6:50pm UTC](https://discourse.hibernate.org/t/hibernate-6-upgrade-causes-nullpointerexception/8780/4 "2024-12-15T18:50:24Z")

</div>

Hi. I created [Jira](https://hibernate.atlassian.net/browse/HHH-18943)
