From b857952dbf3d65b3a2a888391070748e37e7bae7 Mon Sep 17 00:00:00 2001 From: Bragolgirith <6455473+Bragolgirith@users.noreply.github.com> Date: Sat, 9 Dec 2023 10:10:26 +0100 Subject: [PATCH] Add reproducer for HHH-17484 --- .../src/test/java/com/example/domain/Pet.java | 37 +++++++++++++++++++ .../envers/bugs/EnversUnitTestCase.java | 37 +++++++++---------- 2 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 envers/envers-6/src/test/java/com/example/domain/Pet.java diff --git a/envers/envers-6/src/test/java/com/example/domain/Pet.java b/envers/envers-6/src/test/java/com/example/domain/Pet.java new file mode 100644 index 00000000..6260822b --- /dev/null +++ b/envers/envers-6/src/test/java/com/example/domain/Pet.java @@ -0,0 +1,37 @@ +package com.example.domain; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; + +import org.hibernate.envers.Audited; + +@Entity +@Audited +public class Pet { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Lob + private String description; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/envers/envers-6/src/test/java/org/hibernate/envers/bugs/EnversUnitTestCase.java b/envers/envers-6/src/test/java/org/hibernate/envers/bugs/EnversUnitTestCase.java index 0ddd6e51..305c1f0b 100644 --- a/envers/envers-6/src/test/java/org/hibernate/envers/bugs/EnversUnitTestCase.java +++ b/envers/envers-6/src/test/java/org/hibernate/envers/bugs/EnversUnitTestCase.java @@ -6,9 +6,13 @@ */ package org.hibernate.envers.bugs; +import org.hibernate.Session; +import org.hibernate.Transaction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; import org.hibernate.envers.AuditReader; + +import com.example.domain.Pet; import org.junit.Test; /** @@ -21,24 +25,9 @@ public class EnversUnitTestCase extends AbstractEnversTestCase { @Override protected Class[] getAnnotatedClasses() { return new Class[] { -// Foo.class, -// Bar.class - }; - } - - // If you use *.hbm.xml mappings, instead of annotations, add the mappings here. - @Override - protected String[] getMappings() { - return new String[] { -// "Foo.hbm.xml", -// "Bar.hbm.xml" + Pet.class, }; } - // If those mappings reside somewhere other than resources/org/hibernate/test, change this. - @Override - protected String getBaseForMappings() { - return "org/hibernate/test/"; - } // Add in any settings that are specific to your test. See resources/hibernate.properties for the defaults. @Override @@ -52,8 +41,18 @@ protected void configure(Configuration configuration) { // Add your tests, using standard JUnit. @Test - public void hhh123Test() throws Exception { - AuditReader reader = getAuditReader(); - // Do stuff... + public void hhh17484Test() throws Exception { + Session s = openSession(); + Transaction tx = s.beginTransaction(); + + final Pet pet = new Pet(); + pet.setDescription("Meet Whiskers, the enigmatic feline wizard with emerald eyes and a sleek obsidian coat " + + "adorned with silver constellations. This magical cat enchants with a purr that sparkles like stardust, " + + "whisking you away to whimsical realms where dreams and reality entwine in a symphony of enchantment."); + + s.persist( pet ); + + tx.commit(); + s.close(); } }