# Changes in jsonb-field do not mark entity as dirty

**URL:** <https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684>\
**Category:** Hibernate ORM\
**Created:** [May 23, 2023, 6:58am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684 "2023-05-23T06:58:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Thiel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/christian_thiel/32/2439_2.png) [@Christian\_Thiel](https://discourse.hibernate.org/u/Christian_Thiel)\
**Post date:** [May 23, 2023, 6:58am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/1 "2023-05-23T06:58:09Z")

</div>

Hello,

i have a json-field in an entity like this

```auto
@JdbcTypeCode(SqlTypes.JSON)
private MyJson jsonProperty;

```

Where MyJson is a simple POJO:

```auto
@Embeddable
public class MyJson {
    private String stringProp;
    private Long longProp;
}

```

If i alter any of the properties of the json-field, these changes seem not to mark the entity as dirty → the changes are not updated in the DB.  
Is there anything special to be considered when handling with json that i’m missing?

---

<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:** [May 23, 2023, 9:01am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/2 "2023-05-23T09:01:01Z")

</div>

Which Hibernate version are you using?

---

<div class="post-metadata">

**Author:** ![Christian\_Thiel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/christian_thiel/32/2439_2.png) [@Christian\_Thiel](https://discourse.hibernate.org/u/Christian_Thiel)\
**Post date:** [May 23, 2023, 9:03am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/3 "2023-05-23T09:03:33Z")

</div>

I have a Quarkus 3.0.3 test-project with hibernate 6.2.1

---

<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:** [May 23, 2023, 9:14am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/4 "2023-05-23T09:14:13Z")

</div>

Please try updating to 6.2.3.Final

---

<div class="post-metadata">

**Author:** ![Christian\_Thiel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/christian_thiel/32/2439_2.png) [@Christian\_Thiel](https://discourse.hibernate.org/u/Christian_Thiel)\
**Post date:** [May 23, 2023, 9:40am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/5 "2023-05-23T09:40:16Z")

</div>

My Quarkus 3.0.3 test-project is not working when i try to override the hibernate version to 6.2.3.Final manually  
…i will try to build a quarkus localy with this hibernate-version and try this  
edit: if have problems to make a local Quarkus build and asked for help in [Quarkus zulip](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/build.20localy/near/360520926).

edit2: @beikov I found the already merged [quarkus-branch to integrate hiberante-orm 6.2.3](https://github.com/Sanne/quarkus/tree/ORM6), built it localy and used it in my test-project.  
My tests still fail: changes in the json-object are not written to the DB 😥

---

<div class="post-metadata">

**Author:** ![Christian\_Thiel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/christian_thiel/32/2439_2.png) [@Christian\_Thiel](https://discourse.hibernate.org/u/Christian_Thiel)\
**Post date:** [May 24, 2023, 8:51am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/6 "2023-05-24T08:51:27Z")

</div>

I created [[HHH-16682] - Hibernate JIRA](https://hibernate.atlassian.net/browse/HHH-16682)

---

<div class="post-metadata">

**Author:** ![Christian\_Thiel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/christian_thiel/32/2439_2.png) [@Christian\_Thiel](https://discourse.hibernate.org/u/Christian_Thiel)\
**Post date:** [May 31, 2023, 7:06am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/7 "2023-05-31T07:06:30Z")

</div>

@beikov Do you think it could be a quarkus transaction-handling issue? See activity in [task](https://hibernate.atlassian.net/browse/HHH-16682)  
(sorry to continue here…somehow i was not able to mention/link you’re account in the task)

---

<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:** [May 31, 2023, 7:20am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/8 "2023-05-31T07:20:07Z")

</div>

Sorry, I’d have to play around with this to say for sure. I’ll see if I can work on this later this week and ping you on the JIRA issue.

---

<div class="post-metadata">

**Author:** ![Kamil\_Toszek](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/kamil_toszek/32/2462_2.png) [@Kamil\_Toszek](https://discourse.hibernate.org/u/Kamil_Toszek)\
**Post date:** [June 1, 2023, 8:52pm UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/9 "2023-06-01T20:52:00Z")

</div>

It’s (probably) not quarkus related. I’ve got the same issue in spring boot 2.7 using hibernate-types:

@Type(type = “jsonb”)  
@Column(name = “settings”, columnDefinition = “jsonb”)  
SortedSet settings;

If I update just settings, nothing is persisted, if I update settings and some other property in entity, settings are updated properly…

---

<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:** [June 5, 2023, 8:39am UTC](https://discourse.hibernate.org/t/changes-in-jsonb-field-do-not-mark-entity-as-dirty/7684/10 "2023-06-05T08:39:27Z")

</div>

I found a bug in Hibernate 6.2 and fixed that as part of [[HHH-16682] - Hibernate JIRA](https://hibernate.atlassian.net/browse/HHH-16682). No idea what the problem is with Vlads hibernate-types, but it’s better you ask that on the issue tracker of that project: [GitHub - vladmihalcea/hypersistence-utils: The Hypersistence Utils library (previously known as Hibernate Types) gives you Spring and Hibernate utilities that can help you get the most out of your data access layer.](https://github.com/vladmihalcea/hypersistence-utils)
