Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Oct 18, 2007 · 0 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 M3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant