From 465c3b1e9c9fe76a22d04a3c8eb0b4aa104abaee Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Mon, 18 Nov 2013 16:17:31 -0600 Subject: [PATCH] HHH-8684 - Named output parameters don't work for stored procedure call --- .../sql/storedproc/StoredProcedureTest.java | 72 ++++++++++--------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/test/sql/storedproc/StoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/test/sql/storedproc/StoredProcedureTest.java index 01afc956e5..64c11eac9a 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/sql/storedproc/StoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/sql/storedproc/StoredProcedureTest.java @@ -235,30 +235,31 @@ public class StoredProcedureTest extends BaseCoreFunctionalTestCase { session.close(); } - @Test - public void testInParametersByName() { - Session session = openSession(); - session.beginTransaction(); - - ProcedureCall query = session.createStoredProcedureCall( "findUserRange" ); - query.registerParameter( "start", Integer.class, ParameterMode.IN ).bindValue( 1 ); - query.registerParameter( "end", Integer.class, ParameterMode.IN ).bindValue( 2 ); - ProcedureOutputs procedureResult = query.getOutputs(); - Output currentOutput = procedureResult.getCurrent(); - assertNotNull( currentOutput ); - ResultSetOutput resultSetReturn = assertTyping( ResultSetOutput.class, currentOutput ); - List results = resultSetReturn.getResultList(); - assertEquals( 1, results.size() ); - Object result = results.get( 0 ); - assertTyping( Object[].class, result ); - Integer id = (Integer) ( (Object[]) result )[0]; - String name = (String) ( (Object[]) result )[1]; - assertEquals( 1, (int) id ); - assertEquals( "User 1", name ); - - session.getTransaction().commit(); - session.close(); - } +// H2 does not support named parameters +// @Test +// public void testInParametersByName() { +// Session session = openSession(); +// session.beginTransaction(); +// +// ProcedureCall query = session.createStoredProcedureCall( "findUserRange" ); +// query.registerParameter( "start", Integer.class, ParameterMode.IN ).bindValue( 1 ); +// query.registerParameter( "end", Integer.class, ParameterMode.IN ).bindValue( 2 ); +// ProcedureOutputs procedureResult = query.getOutputs(); +// Output currentOutput = procedureResult.getCurrent(); +// assertNotNull( currentOutput ); +// ResultSetOutput resultSetReturn = assertTyping( ResultSetOutput.class, currentOutput ); +// List results = resultSetReturn.getResultList(); +// assertEquals( 1, results.size() ); +// Object result = results.get( 0 ); +// assertTyping( Object[].class, result ); +// Integer id = (Integer) ( (Object[]) result )[0]; +// String name = (String) ( (Object[]) result )[1]; +// assertEquals( 1, (int) id ); +// assertEquals( "User 1", name ); +// +// session.getTransaction().commit(); +// session.close(); +// } @Test public void testInParametersByPosition() { @@ -305,17 +306,18 @@ public class StoredProcedureTest extends BaseCoreFunctionalTestCase { } } - { - ProcedureCall query = session.createStoredProcedureCall( "findUserRange" ); - query.registerParameter( "start", Integer.class, ParameterMode.IN ); - query.registerParameter( "end", Integer.class, ParameterMode.IN ).bindValue( 2 ); - try { - query.getOutputs(); - fail( "Expecting failure due to missing parameter bind" ); - } - catch (JDBCException expected) { - } - } +// H2 does not support named parameters +// { +// ProcedureCall query = session.createStoredProcedureCall( "findUserRange" ); +// query.registerParameter( "start", Integer.class, ParameterMode.IN ); +// query.registerParameter( "end", Integer.class, ParameterMode.IN ).bindValue( 2 ); +// try { +// query.getOutputs(); +// fail( "Expecting failure due to missing parameter bind" ); +// } +// catch (JDBCException expected) { +// } +// } session.getTransaction().commit(); session.close();