Changes in jsonb-field do not mark entity as dirty

Hello,

i have a json-field in an entity like this

@JdbcTypeCode(SqlTypes.JSON)
private MyJson jsonProperty;

Where MyJson is a simple POJO:

@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?

Which Hibernate version are you using?

I have a Quarkus 3.0.3 test-project with hibernate 6.2.1

Please try updating to 6.2.3.Final

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.

edit2: @beikov I found the already merged quarkus-branch to integrate hiberante-orm 6.2.3, 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 :disappointed_relieved:

1 Like

I created [HHH-16682] - Hibernate JIRA

1 Like

@beikov Do you think it could be a quarkus transaction-handling issue? See activity in task
(sorry to continue here…somehow i was not able to mention/link you’re account in the task)

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.

1 Like

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…

I found a bug in Hibernate 6.2 and fixed that as part of [HHH-16682] - Hibernate JIRA. 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.

1 Like