Description
Celal Ziftci opened SPR-3987 and commented
After the following change: http://opensource.atlassian.com/projects/spring/browse/SPR-3898
StoredProcedure class doesn't need to be abstract. If it were to be a concrete class, we could put it entirely into the config file.
Below is an example;
<bean id="storedProc" class="org.springframework.jdbc.object.StoredProcedure">
<property name="dataSource"><ref bean="someDataSource"/></property>
<property name="sql" value="sp_someStoredProc"/>
<property name="parameters">
<list>
<bean class="org.springframework.jdbc.core.SqlReturnResultSet">
<constructor-arg value="resultSet1"/>
<constructor-arg><bean class="some.package.PairRowMapper"></bean></constructor-arg>
</bean>
<bean class="org.springframework.jdbc.core.SqlParameter">
<constructor-arg index="0" value="intData"/>
<constructor-arg index="1"><util:constant static-field="java.sql.Types.INTEGER"/></constructor-arg>
</bean>
<bean class="org.springframework.jdbc.core.SqlOutParameter">
<constructor-arg value="outParam"/>
<constructor-arg><util:constant static-field="java.sql.Types.INTEGER"/></constructor-arg>
</bean>
</list>
</property>
</bean>
If this is not seen as appropriate, then adding a concrete implementation (which does absolutely nothing, just an empty concrete implementation that extends StoredProcedure) would also allow us to do the same. Then in the code, we would do:
StoredProcedure sp = ( StoredProcedure ) _context.getBean( "storedProc" );
Map inParams = new HashMap();
inParams.put( "intData", 5 );
Map spResults = sp.execute( inParams );
Object outParam = spResults.get( "outParam" );
Object result = spResults.get( "resultSet1" );
Affects: 2.0.6, 2.1 M4, 2.5 RC1