From f191d397c1e6dd1042eca8253984a64d4cbc9695 Mon Sep 17 00:00:00 2001 From: Cedomir Igaly Date: Thu, 18 Jan 2024 18:01:42 +0100 Subject: [PATCH] HHH-17613 - Test case demonstrating the problem --- .../jpamodelgen/test/hhh17613/ChildB.java | 7 ++++++ .../test/hhh17613/HHH17613Test.java | 22 +++++++++++++++++++ .../jpamodelgen/test/hhh17613/Parent.java | 11 ++++++++++ .../jpamodelgen/test/hhh17613/a/ChildA.java | 18 +++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/ChildB.java create mode 100644 tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/HHH17613Test.java create mode 100644 tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/Parent.java create mode 100644 tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/a/ChildA.java diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/ChildB.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/ChildB.java new file mode 100644 index 0000000000..bb7ef6f411 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/ChildB.java @@ -0,0 +1,7 @@ +package org.hibernate.jpamodelgen.test.hhh17613; + +import jakarta.persistence.MappedSuperclass; + +@MappedSuperclass +public abstract class ChildB extends Parent { +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/HHH17613Test.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/HHH17613Test.java new file mode 100644 index 0000000000..36c004369e --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/HHH17613Test.java @@ -0,0 +1,22 @@ +package org.hibernate.jpamodelgen.test.hhh17613; + +import org.hibernate.jpamodelgen.test.hhh17613.a.ChildA; +import org.hibernate.jpamodelgen.test.util.CompilationTest; +import org.hibernate.jpamodelgen.test.util.TestForIssue; +import org.hibernate.jpamodelgen.test.util.TestUtil; +import org.hibernate.jpamodelgen.test.util.WithClasses; + +import org.junit.Test; + +@TestForIssue(jiraKey = " HHH-17613") +public class HHH17613Test extends CompilationTest { + + @Test + @WithClasses({ ChildA.class, ChildB.class, Parent.class }) + @TestForIssue(jiraKey = " HHH-17613") + public void test() { + System.out.println( TestUtil.getMetaModelSourceAsString( ChildA.class ) ); + System.out.println( TestUtil.getMetaModelSourceAsString( ChildB.class ) ); + System.out.println( TestUtil.getMetaModelSourceAsString( Parent.class ) ); + } +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/Parent.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/Parent.java new file mode 100644 index 0000000000..2f04d9b48c --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/Parent.java @@ -0,0 +1,11 @@ +package org.hibernate.jpamodelgen.test.hhh17613; + +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; + +@MappedSuperclass +public abstract class Parent { + + @Id + private Long id; +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/a/ChildA.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/a/ChildA.java new file mode 100644 index 0000000000..bbea629e48 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hhh17613/a/ChildA.java @@ -0,0 +1,18 @@ +package org.hibernate.jpamodelgen.test.hhh17613.a; + +import java.util.HashSet; +import java.util.Set; + +import org.hibernate.jpamodelgen.test.hhh17613.ChildB; +import org.hibernate.jpamodelgen.test.hhh17613.Parent; + +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.OneToMany; + +@MappedSuperclass +public abstract class ChildA> extends Parent { + + @OneToMany + private Set bs = new HashSet<>(); + +}