# org.hibernate.query.SemanticException Cannot assign expression of type 'java.io.Serializable' to target path 'alias\_1388715014.customProperties' of type 'java.util.Map\<java.lang.String, java.lang.String\>'

**URL:** <https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094>\
**Category:** Hibernate ORM\
**Created:** [February 25, 2024, 6:00pm UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094 "2024-02-25T18:00:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_Thankachan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/deepak_thankachan/32/3051_2.png) [@Deepak\_Thankachan](https://discourse.hibernate.org/u/Deepak_Thankachan)\
**Post date:** [February 25, 2024, 6:00pm UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/1 "2024-02-25T18:00:03Z")

</div>

Hi,

Recently migrated from SpringBoot 2 to 3 and that also brought in updated version of hibernate.

Had to redefine JSONB properties like so:

```auto
@Entity
@Data
public class Job {

    private String jobType;

    @JdbcTypeCode(SqlTypes.JSON)
    @Basic(fetch = FetchType.LAZY)
    private Map<String, String> customProperties;

}

```

Have a criteria builder which then updates the job like so:

```auto
----------------------------- code omitted
        CriteriaUpdate<Job> criteriaUpdate = cb.createCriteriaUpdate(Job.class);
        criteriaUpdate.set("jobType","default");
        criteriaUpdate.set("customProperties", Collections.emptyMap()); // this line causes the error
---------------------------- code omitted

```

keep getting this error: “stackTrace”:"org.hibernate.query.SemanticException: Cannot assign expression of type ‘java.io.Serializable’ to target path ‘alias\_1388715014.customProperties’ of type ‘java.util.Map\<java.lang.String, java.lang.String\>’\n\tat org.hibernate.query.sqm.internal.TypecheckUtil.assertAssignable(TypecheckUtil.java:384)

\<hibernate.version\>6.1.7.Final\</hibernate.version\>  
\<hibernate-validator.version\>8.0.0.Final\</hibernate-validator.version\>

Regards and thanks in advance,

Deepak

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [February 26, 2024, 9:30am UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/2 "2024-02-26T09:30:01Z")

</div>

Hibernate ORM 6.1 is not supported anymore. Please update to version 6.4.4.Final.  
If you still have problems, please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and if you are able to reproduce the issue, create a bug ticket in our [issue tracker](https://hibernate.atlassian.net) and attach that reproducer.

---

<div class="post-metadata">

**Author:** ![Deepak\_Thankachan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/deepak_thankachan/32/3051_2.png) [@Deepak\_Thankachan](https://discourse.hibernate.org/u/Deepak_Thankachan)\
**Post date:** [February 26, 2024, 10:17am UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/3 "2024-02-26T10:17:36Z")

</div>

Sorry my bad just double checked we are on hibernate version 6.4.1.Final

---

<div class="post-metadata">

**Author:** ![Deepak\_Thankachan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/deepak_thankachan/32/3051_2.png) [@Deepak\_Thankachan](https://discourse.hibernate.org/u/Deepak_Thankachan)\
**Post date:** [February 26, 2024, 11:14am UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/4 "2024-02-26T11:14:50Z")

</div>

Digging into this a bit more it looks like I started seeing this issue when Hibernate version went from 6.1 to 6.2. I saw the [hibernate 6.2 migration guide](https://github.com/hibernate/hibernate-orm/blob/6.2/migration-guide.adoc) and it does mention something about JSON mapping changes. I am using a postgres DB and the data is stored as jsonb. Looks like someone already raised this too [Mapping Jsonb (postgres) in 6.2.3.Final](https://discourse.hibernate.org/t/mapping-jsonb-postgres-in-6-2-3-final/8431)

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [February 26, 2024, 2:43pm UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/5 "2024-02-26T14:43:46Z")

</div>

Maybe this is the same issue, I don’t know. But either way, if you want that anyone looks into this, please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and if you are able to reproduce the issue, create a bug ticket in our [issue tracker](https://hibernate.atlassian.net) and attach that reproducer.

---

<div class="post-metadata">

**Author:** ![Deepak\_Thankachan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/deepak_thankachan/32/3051_2.png) [@Deepak\_Thankachan](https://discourse.hibernate.org/u/Deepak_Thankachan)\
**Post date:** [February 29, 2024, 11:31am UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/6 "2024-02-29T11:31:38Z")

</div>

cheers, will try to raise it on the board

---

<div class="post-metadata">

**Author:** ![Petko\_Georgiev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/petko_georgiev/32/3189_2.png) [@Petko\_Georgiev](https://discourse.hibernate.org/u/Petko_Georgiev)\
**Post date:** [May 7, 2024, 10:49am UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/7 "2024-05-07T10:49:24Z")

</div>

Hey, I am seeing similar behaviour. Did you raise an issue or found a workaround? @Deepak_Thankachan

---

<div class="post-metadata">

**Author:** ![Deepak\_Thankachan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/deepak_thankachan/32/3051_2.png) [@Deepak\_Thankachan](https://discourse.hibernate.org/u/Deepak_Thankachan)\
**Post date:** [May 8, 2024, 2:12pm UTC](https://discourse.hibernate.org/t/org-hibernate-query-semanticexception-cannot-assign-expression-of-type-java-io-serializable-to-target-path-alias-1388715014-customproperties-of-type-java-util-map-java-lang-string-java-lang-string/9094/8 "2024-05-08T14:12:28Z")

</div>

> [@Petko\_Georgiev](#):
>
> n issue or found a workaround?

Hi, no I didn’t raise one. Using an old version before it broke.
