HHH-11904 - EnumExplicitTypeTest test assert fails on mariadb clusters
This commit is contained in:
parent
2fe8e5e340
commit
af4a76e6a9
|
@ -6,12 +6,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.enums;
|
package org.hibernate.test.enums;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,21 +25,21 @@ public class EnumExplicitTypeTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-10766")
|
@TestForIssue(jiraKey = "HHH-10766")
|
||||||
public void hbmEnumWithExplicitTypeTest() {
|
public void hbmEnumWithExplicitTypeTest() {
|
||||||
Session s = openSession();
|
long id = doInHibernate( this::sessionFactory, session -> {
|
||||||
s.getTransaction().begin();
|
Person person = Person.person(Gender.MALE, HairColor.BROWN);
|
||||||
Person painted = Person.person( Gender.MALE, HairColor.BROWN );
|
person.setOriginalHairColor(HairColor.BLONDE);
|
||||||
painted.setOriginalHairColor( HairColor.BLONDE );
|
session.persist(person);
|
||||||
s.persist( painted );
|
|
||||||
s.getTransaction().commit();
|
|
||||||
s.clear();
|
|
||||||
|
|
||||||
s.getTransaction().begin();
|
return person.getId();
|
||||||
Number id = (Number) session.createNativeQuery(
|
} );
|
||||||
|
|
||||||
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
|
Number personId = (Number) session.createNativeQuery(
|
||||||
"select id from Person where originalHairColor = :color")
|
"select id from Person where originalHairColor = :color")
|
||||||
.setParameter("color", HairColor.BLONDE.name())
|
.setParameter("color", HairColor.BLONDE.name())
|
||||||
.getSingleResult();
|
.getSingleResult();
|
||||||
assertEquals( 1L, id.longValue() );
|
|
||||||
s.getTransaction().commit();
|
assertEquals( id, personId.longValue() );
|
||||||
s.close();
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue