Re-enabled additional test

This commit is contained in:
Andrea Boriero 2020-07-01 19:04:14 +01:00
parent 61e141cabf
commit bfd15ec0e8
1 changed files with 43 additions and 23 deletions

View File

@ -21,43 +21,62 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.test.inheritance.discriminator; package org.hibernate.orm.test.inheritance.discriminator;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.ManyToMany;
import javax.persistence.MappedSuperclass;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
/** /**
* Originally from https://github.com/mkaletka/hibernate-test-case-templates/commit/2b3c075cacd07474d5565fa3bd5a6d0a48683dc0 * Originally from https://github.com/mkaletka/hibernate-test-case-templates/commit/2b3c075cacd07474d5565fa3bd5a6d0a48683dc0
* *
* @author Christian Beikov * @author Christian Beikov
*/ */
public class MappedSuperclassExtendsEntityTest extends BaseCoreFunctionalTestCase { @DomainModel(
annotatedClasses = {
MappedSuperclassExtendsEntityTest.TestEntity.class,
MappedSuperclassExtendsEntityTest.GrandParent.class,
MappedSuperclassExtendsEntityTest.Parent.class,
MappedSuperclassExtendsEntityTest.Child1.class,
MappedSuperclassExtendsEntityTest.Child2.class
}
)
@SessionFactory
public class MappedSuperclassExtendsEntityTest {
@Override @Test
protected Class<?>[] getAnnotatedClasses() { @TestForIssue(jiraKey = "HHH-12332")
return new Class[] { public void testQueryingSingle(SessionFactoryScope scope) {
TestEntity.class, // Make sure that the produced query for th
GrandParent.class, scope.inTransaction(
Parent.class, s ->
Child1.class, s.createQuery(
Child2.class "FROM TestEntity e JOIN e.parents p1 JOIN p1.entities JOIN p1.entities2 JOIN e.parents2 p2 JOIN p2.entities JOIN p2.entities2" )
}; .getResultList()
);
} }
@Test @Test
@TestForIssue(jiraKey = "HHH-12332") @TestForIssue(jiraKey = "HHH-12332")
public void testQueryingSingle() { public void testHql(SessionFactoryScope scope) {
// Make sure that the produced query for th // Make sure that the produced query for th
doInHibernate( this::sessionFactory, s -> { scope.inTransaction(
s.createQuery( "FROM TestEntity e JOIN e.parents p1 JOIN p1.entities JOIN p1.entities2 JOIN e.parents2 p2 JOIN p2.entities JOIN p2.entities2" ).getResultList(); s ->
} ); s.createQuery( "from TestEntity" ).list()
);
} }
@Entity(name = "GrandParent") @Entity(name = "GrandParent")
@ -66,9 +85,10 @@ public class MappedSuperclassExtendsEntityTest extends BaseCoreFunctionalTestCas
public static abstract class GrandParent implements Serializable { public static abstract class GrandParent implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue @GeneratedValue
private Long id; private Long id;
@ManyToMany(mappedBy = "parents2") @ManyToMany(mappedBy = "parents2")
private List<TestEntity> entities2; private List<TestEntity> entities2;