HHH-11073 : test case
This commit is contained in:
parent
b28e0974df
commit
4551e521c1
|
@ -63,6 +63,26 @@ public class QueryWithLiteralsInSelectExpressionTest extends BaseEntityManagerFu
|
|||
).getResultList();
|
||||
Assert.assertEquals( 1, elements.size() );
|
||||
Assert.assertEquals( 3, elements.get( 0 ).length );
|
||||
Assert.assertEquals( true, elements.get( 0 )[0] );
|
||||
Assert.assertEquals( false, elements.get( 0 )[1] );
|
||||
Assert.assertEquals( "Fab", elements.get( 0 )[2] );
|
||||
}
|
||||
finally {
|
||||
entityManager.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-10230")
|
||||
public void testSelectNonNullLiteralsCastToBoolean() {
|
||||
final EntityManager entityManager = getOrCreateEntityManager();
|
||||
try {
|
||||
final List<Object[]> elements = entityManager.createQuery(
|
||||
"SELECT cast( true as boolean ), cast( false as boolean ), e.name FROM MyEntity e",
|
||||
Object[].class
|
||||
).getResultList();
|
||||
Assert.assertEquals( 1, elements.size() );
|
||||
Assert.assertEquals( 3, elements.get( 0 ).length );
|
||||
Assert.assertEquals( true, elements.get( 0 )[ 0 ] );
|
||||
Assert.assertEquals( false, elements.get( 0 )[ 1 ] );
|
||||
Assert.assertEquals( "Fab", elements.get( 0 )[ 2 ] );
|
||||
|
@ -78,7 +98,7 @@ public class QueryWithLiteralsInSelectExpressionTest extends BaseEntityManagerFu
|
|||
final EntityManager entityManager = getOrCreateEntityManager();
|
||||
try {
|
||||
final List<Object[]> elements = entityManager.createQuery(
|
||||
"SELECT cast(null as char), false, e.name FROM MyEntity e",
|
||||
"SELECT cast(null as boolean), false, e.name FROM MyEntity e",
|
||||
Object[].class
|
||||
).getResultList();
|
||||
Assert.assertEquals( 1, elements.size() );
|
||||
|
|
Loading…
Reference in New Issue