HHH-9160 - javax.persistence.Query#getParameterValue(String) returns the ParameterRegistration not the parameter value
(cherry picked from commit eb2f33328d
)
This commit is contained in:
parent
691d8725d9
commit
315e57c6aa
|
@ -32,7 +32,7 @@ import org.hibernate.jpa.criteria.path.RootImpl;
|
|||
|
||||
/**
|
||||
* Models basic query structure. Used as a delegate in implementing both
|
||||
* {@link org.hibernate.criterion.CriteriaQuery} and
|
||||
* {@link javax.persistence.criteria.CriteriaQuery} and
|
||||
* {@link javax.persistence.criteria.Subquery}.
|
||||
* <p/>
|
||||
* Note the <tt>ORDER BY</tt> specs are neglected here. That's because it is not valid
|
||||
|
|
|
@ -189,7 +189,7 @@ public class CriteriaQueryTypeQueryAdapter<X> implements TypedQuery<X>, Hibernat
|
|||
public Object getParameterValue(String name) {
|
||||
entityManager.checkOpen( false );
|
||||
locateParameterByName( name );
|
||||
return jpqlQuery.getParameter( name );
|
||||
return jpqlQuery.getParameterValue( name );
|
||||
}
|
||||
|
||||
private ExplicitParameterInfo locateParameterByName(String name) {
|
||||
|
|
|
@ -18,7 +18,9 @@ import org.junit.Test;
|
|||
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -37,6 +39,7 @@ public class ParameterTest extends BaseEntityManagerFunctionalTestCase {
|
|||
criteria.where( em.getCriteriaBuilder().equal( someBytesPath, param ) );
|
||||
TypedQuery<MultiTypedBasicAttributesEntity> query = em.createQuery( criteria );
|
||||
query.setParameter( param, new byte[] { 1,1,1 } );
|
||||
assertThat( query.getParameterValue( param.getName() ), instanceOf( byte[].class) );
|
||||
query.getResultList();
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
@ -54,6 +57,7 @@ public class ParameterTest extends BaseEntityManagerFunctionalTestCase {
|
|||
criteria.where( em.getCriteriaBuilder().equal( thePath, param ) );
|
||||
TypedQuery<MultiTypedBasicAttributesEntity> query = em.createQuery( criteria );
|
||||
query.setParameter( param, new Byte[] { Byte.valueOf((byte)1), Byte.valueOf((byte)1), Byte.valueOf((byte)1) } );
|
||||
assertThat( query.getParameterValue( param.getName() ), instanceOf( Byte[].class ) );
|
||||
query.getResultList();
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
|
Loading…
Reference in New Issue