HHH-4299 - Add test for issue
Signed-off-by: Jan Schatteman <jschatte@redhat.com> # Conflicts: # hibernate-core/src/test/java/org/hibernate/orm/test/annotations/embeddables/EmbeddableWithGenericAndMappedSuperClassTest.java
This commit is contained in:
parent
b6eaffeb29
commit
c7074d5ac9
|
@ -6,7 +6,8 @@ import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
@ -24,7 +25,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@DomainModel(
|
@DomainModel(
|
||||||
annotatedClasses = {
|
annotatedClasses = {
|
||||||
EmbeddableWithGenericAndMappedSuperClassTest.PopularBook.class,
|
EmbeddableWithGenericAndMappedSuperClassTest.PopularBook.class,
|
||||||
EmbeddableWithGenericAndMappedSuperClassTest.RareBook.class
|
EmbeddableWithGenericAndMappedSuperClassTest.RareBook.class,
|
||||||
|
EmbeddableWithGenericAndMappedSuperClassTest.GenericExample.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@SessionFactory
|
@SessionFactory
|
||||||
|
@ -35,7 +37,7 @@ public class EmbeddableWithGenericAndMappedSuperClassTest {
|
||||||
private final static long RARE_BOOK_ID = 2l;
|
private final static long RARE_BOOK_ID = 2l;
|
||||||
private final static Integer RARE_BOOK_CODE = 123;
|
private final static Integer RARE_BOOK_CODE = 123;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeAll
|
||||||
public void setUp(SessionFactoryScope scope) {
|
public void setUp(SessionFactoryScope scope) {
|
||||||
scope.inTransaction(
|
scope.inTransaction(
|
||||||
session -> {
|
session -> {
|
||||||
|
@ -47,6 +49,19 @@ public class EmbeddableWithGenericAndMappedSuperClassTest {
|
||||||
|
|
||||||
session.persist( popularBook );
|
session.persist( popularBook );
|
||||||
session.persist( rareBook );
|
session.persist( rareBook );
|
||||||
|
|
||||||
|
session.persist( new GenericExample(1, new Range<>(2, 3)) );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
public void tearDown(SessionFactoryScope scope) {
|
||||||
|
scope.inTransaction(
|
||||||
|
session -> {
|
||||||
|
session.createMutationQuery( "delete from PopularBook" ).executeUpdate();
|
||||||
|
session.createMutationQuery( "delete from RareBook" ).executeUpdate();
|
||||||
|
session.createMutationQuery( "delete from GenericExample" ).executeUpdate();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue