HHH-10796 - Add test for issue

(cherry picked from commit 6027d8319e)
This commit is contained in:
Andrea Boriero 2016-06-03 12:29:02 +01:00 committed by Gail Badner
parent 66f08002cb
commit ea4ddbd690
1 changed files with 39 additions and 1 deletions

View File

@ -6,10 +6,12 @@
*/
package org.hibernate.test.hql;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.hibernate.query.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.resource.transaction.spi.TransactionStatus;
@ -104,6 +106,42 @@ public class ParameterTest extends BaseCoreFunctionalTestCase {
}
}
@Test
@TestForIssue(jiraKey = "HHH-10796")
public void testSetPropertiesMapNotContainingAllTheParameters() throws Exception {
Session s = openSession();
Transaction t = s.beginTransaction();
try {
Human human = new Human();
human.setNickName( "nick" );
human.setIntValue( 1 );
s.save( human );
Map parameters = new HashMap();
parameters.put( "nickNames", "nick" );
List<Integer> intValues = new ArrayList<>();
intValues.add( 1 );
Query q = s.createQuery(
"from Human h where h.nickName in (:nickNames) and h.intValue in (:intValues)" );
q.setParameterList( "intValues" , intValues);
q.setProperties( (parameters) );
assertThat( q.list().size(), is( 1 ) );
s.delete( human );
t.commit();
}
catch (Exception e) {
if ( session.getTransaction().getStatus() == TransactionStatus.ACTIVE ) {
session.getTransaction().rollback();
}
throw e;
}
finally {
s.close();
}
}
@Test
@TestForIssue( jiraKey = "HHH-9154" )
public void testObjectAsParameter() {