List of usage examples for org.springframework.jdbc.core.simple SimpleJdbcCall executeObject
@Override @SuppressWarnings("unchecked") public <T> T executeObject(Class<T> returnType, SqlParameterSource args)
From source file:org.springframework.jdbc.core.simple.SimpleJdbcCallTests.java
public void testAddInvoiceProcWithoutMetaDataUsingMapParamSource() throws Exception { final int amount = 1103; final int custid = 3; initializeAddInvoiceWithoutMetaData(false); replay();//from www . j a v a 2s .c om SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice"); adder.declareParameters(new SqlParameter("amount", Types.INTEGER), new SqlParameter("custid", Types.INTEGER), new SqlOutParameter("newid", Types.INTEGER)); Number newId = adder.executeObject(Number.class, new MapSqlParameterSource().addValue("amount", amount).addValue("custid", custid)); assertEquals(4, newId.intValue()); }
From source file:org.springframework.jdbc.core.simple.SimpleJdbcCallTests.java
public void testAddInvoiceProcWithMetaDataUsingMapParamSource() throws Exception { final int amount = 1103; final int custid = 3; MockControl ctrlResultSet = initializeAddInvoiceWithMetaData(false); ctrlResultSet.replay();//from w w w . j a v a2 s.c om replay(); SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice"); Number newId = adder.executeObject(Number.class, new MapSqlParameterSource().addValue("amount", amount).addValue("custid", custid)); assertEquals(4, newId.intValue()); ctrlResultSet.verify(); }