Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-17484: Wrong column type generated for Envers audit tables #343

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions envers/envers-6/src/test/java/com/example/domain/Pet.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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
Expand All @@ -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();
}
}