|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.jdbc.StoredProcPollingChannelAdapter
public class StoredProcPollingChannelAdapter
A polling channel adapter that creates messages from the payload returned by executing a stored procedure or Sql function. Optionally an update can be executed after the execution of the Stored Procedure or Function in order to update processed rows.
| Field Summary |
|---|
| Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
StoredProcPollingChannelAdapter(javax.sql.DataSource dataSource,
java.lang.String storedProcedureName)
Constructor taking DataSource from which the DB Connection can be
obtained and the stored procedure name to execute. |
|
| Method Summary | |
|---|---|
protected java.util.Map<java.lang.String,?> |
doPoll()
|
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information. |
protected void |
onInit()
Subclasses may implement this for initialization logic. |
Message<java.lang.Object> |
receive()
Executes the query. |
void |
setExpectSingleResult(boolean expectSingleResult)
This parameter indicates that only one result object shall be returned from the Stored Procedure/Function Call. |
void |
setFunction(boolean isFunction)
Indicates whether a Stored Procedure or a Function is being executed. |
void |
setIgnoreColumnMetaData(boolean ignoreColumnMetaData)
|
void |
setProcedureParameters(java.util.List<ProcedureParameter> procedureParameters)
|
void |
setReturningResultSetRowMappers(java.util.Map<java.lang.String,RowMapper<?>> returningResultSetRowMappers)
Does your stored procedure return one or more result sets? If so, you can use the provided method for setting the respective Rowmappers. |
void |
setReturnValueRequired(boolean returnValueRequired)
|
void |
setSqlParameters(java.util.List<SqlParameter> sqlParameters)
Explicit declarations are necessary if the database you use is not a Spring-supported database. |
void |
setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory)
|
| Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
|---|
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StoredProcPollingChannelAdapter(javax.sql.DataSource dataSource,
java.lang.String storedProcedureName)
DataSource from which the DB Connection can be
obtained and the stored procedure name to execute.
dataSource - used to create a SimpleJdbcCallstoredProcedureName - Name of the Stored Procedure or Function to execute| Method Detail |
|---|
protected void onInit()
throws java.lang.Exception
IntegrationObjectSupport
onInit in class IntegrationObjectSupportjava.lang.Exceptionpublic Message<java.lang.Object> receive()
null.
receive in interface MessageSource<java.lang.Object>protected java.util.Map<java.lang.String,?> doPoll()
public java.lang.String getComponentType()
IntegrationObjectSupport
getComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory)
sqlParameterSourceFactory - public void setSqlParameters(java.util.List<SqlParameter> sqlParameters)
http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/jdbc.html
public void setReturningResultSetRowMappers(java.util.Map<java.lang.String,RowMapper<?>> returningResultSetRowMappers)
public void setIgnoreColumnMetaData(boolean ignoreColumnMetaData)
ignoreColumnMetaData - public void setReturnValueRequired(boolean returnValueRequired)
returnValueRequired - public void setProcedureParameters(java.util.List<ProcedureParameter> procedureParameters)
public void setFunction(boolean isFunction)
isFunction - If set to true an Sql Function is executed rather than a Stored Procedure.public void setExpectSingleResult(boolean expectSingleResult)
MessagingException is thrown.
Otherwise the complete resultMap is returned as the Message payload.
Important Note: Several databases such as H2 are not fully supported.
The H2 database, for example, does not fully support the CallableStatement
semantics and when executing function calls against H2, a result list is
returned rather than a single value.
Therefore, even if you set expectSingleResult = true, you may end up with
a collection being returned.
expectSingleResult -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||