Fix tests faiiling on Jenkins

This commit is contained in:
Vlad Mihalcea 2017-09-14 12:39:43 +03:00
parent bd4908449f
commit 0b046885c5
1 changed files with 22 additions and 5 deletions

View File

@ -62,17 +62,34 @@ public class BitSetUserTypeTest extends BaseCoreFunctionalTestCase {
Product product = session.get( Product.class, 1 );
assertEquals(bitSet, product.getBitSet());
} );
}
@Test
public void testNativeQuery() {
BitSet bitSet = BitSet.valueOf( new long[] {1, 2, 3} );
doInHibernate( this::sessionFactory, session -> {
Product product = new Product( );
product.setId( 1 );
product.setBitSet( bitSet );
session.persist( product );
} );
doInHibernate( this::sessionFactory, session -> {
Product product = (Product) session.getNamedNativeQuery(
"find_person_by_bitset")
.setParameter( "id", 1L)
.getSingleResult();
"find_person_by_bitset")
.setParameter( "id", 1L)
.getSingleResult();
assertEquals(bitSet, product.getBitSet());
} );
}
@Override
protected boolean isCleanupTestDataRequired() {
return true;
}
@NamedNativeQuery(
name = "find_person_by_bitset",
query =
@ -88,8 +105,8 @@ public class BitSetUserTypeTest extends BaseCoreFunctionalTestCase {
classes = @ConstructorResult(
targetClass = Product.class,
columns = {
@ColumnResult(name = "id"),
@ColumnResult(name = "bitset", type = BitSetUserType.class)
@ColumnResult(name = "pr.id"),
@ColumnResult(name = "pr.bitset", type = BitSetUserType.class)
}
)
)