From 1b3f3063de6c614ddbc7675f7b2d2a53c2e9c7be Mon Sep 17 00:00:00 2001 From: Edgar Asatryan Date: Fri, 28 Nov 2025 18:59:55 +0400 Subject: [PATCH] A test case for HHH-19964. --- orm/hibernate-orm-7/pom.xml | 5 ++++ .../org/hibernate/bugs/JPAUnitTestCase.java | 23 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/orm/hibernate-orm-7/pom.xml b/orm/hibernate-orm-7/pom.xml index 5ad920b40..680b2f330 100644 --- a/orm/hibernate-orm-7/pom.xml +++ b/orm/hibernate-orm-7/pom.xml @@ -78,6 +78,11 @@ ${version.org.assertj.assertj-core} test + + com.fasterxml.jackson.core + jackson-databind + 2.20.1 + diff --git a/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java b/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java index 3734df49a..c4b070702 100644 --- a/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java +++ b/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java @@ -1,5 +1,11 @@ package org.hibernate.bugs; +import static org.hibernate.type.SqlTypes.JSON; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import java.util.Map; +import org.hibernate.annotations.JdbcTypeCode; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -28,11 +34,24 @@ void destroy() { // Entities are auto-discovered, so just add them anywhere on class-path // Add your tests, using standard JUnit. @Test - void hhh123Test() throws Exception { + void hhh19964Test() throws Exception { EntityManager entityManager = entityManagerFactory.createEntityManager(); entityManager.getTransaction().begin(); - // Do stuff... + + var entity = new Foo(); + entity.properties = Map.of("a", 1, "b", 2); + entityManager.persist(entity); + entityManager.getTransaction().commit(); entityManager.close(); } + + @Entity + public class Foo { + @Id + long id; + + @JdbcTypeCode(JSON) + Object properties; + } }