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(
|
} );
|
||||||
"select id from Person where originalHairColor = :color" )
|
|
||||||
.setParameter( "color", HairColor.BLONDE.name() )
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
.getSingleResult();
|
Number personId = (Number) session.createNativeQuery(
|
||||||
assertEquals( 1L, id.longValue() );
|
"select id from Person where originalHairColor = :color")
|
||||||
s.getTransaction().commit();
|
.setParameter("color", HairColor.BLONDE.name())
|
||||||
s.close();
|
.getSingleResult();
|
||||||
|
|
||||||
|
assertEquals( id, personId.longValue() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue