Skip to content

org.springframework.jdbc.object.StoredProcedure is an abstract class, although it may be allowed to be used as a concrete class after the jira change SPR-3898 [SPR-3987] #8667

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Referenced from: commits 4145c29, 2855e5c, 8fdc57e

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions