HHH-10796 - Add test for issue
This commit is contained in:
parent
8513a55255
commit
6027d8319e
|
@ -6,10 +6,12 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.hql;
|
package org.hibernate.test.hql;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.query.Query;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
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
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-9154" )
|
@TestForIssue( jiraKey = "HHH-9154" )
|
||||||
public void testObjectAsParameter() {
|
public void testObjectAsParameter() {
|
||||||
|
|
Loading…
Reference in New Issue