import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.CallableStatementCreator;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import com.qeweb.redants.dao.ISequenceDao;
public class SequenceDaoImpl extends SimpleJdbcDaoSupport implements
ISequenceDao {
Log log = org.apache.commons.logging.LogFactory
.getLog(SequenceDaoImpl.class);
public String findSequence() {
String result = (String) getJdbcTemplate().execute(
new ProcCallableStatementCreator(),
new ProcCallableStatementCallBack());
log.info("new material Code:" + result);
return result;
}
class ProcCallableStatementCreator implements CallableStatementCreator {
public CallableStatement createCallableStatement(Connection connection)
throws SQLException {
String proc_name = "{call proc_sequence(?)}";
CallableStatement callableStatement = connection
.prepareCall(proc_name);
callableStatement.registerOutParameter(1, java.sql.Types.VARCHAR);
return callableStatement;
}
}
class ProcCallableStatementCallBack implements CallableStatementCallback {
public Object doInCallableStatement(CallableStatement callableStatement)
throws SQLException, DataAccessException {
callableStatement.execute();
String seq = callableStatement.getString(1);
return seq;
}
}
}
分享到:
相关推荐
javaEE 实验三 Spring JDBC与事务管理, 一、实验目的 1、掌握Spring JDBC的配置; 2、掌握JdbcTemplae类中增删改查方法的使用; 3、了解Spring事务管理的3个核心接口; 4、了解Spring事务管理的两种方式; 5、掌握...
Spring JdbcTemplate调用Oracle存储过程输出游标结果集实现增删改查
Spring mvc + Spring + Spring jdbc 整合 demo
Spring JDBC常用Jar包
spring jdbc示例代码,包括增删改查等一系列操作。了解spring jdbc与jdbc、orm框架的区别
spring jdbc相关包版本5.1.3
包含Springjdbc的相关jar包,Spring 框架对JDBC的简单封装,提供了JdbcTemplate对象简化了JDBC的开发。
SpringMVC+SpringJDBC 能正常使用
spring对jdbc的支持的测试jar包下载 spring采用的是4.0版本
Spring mvc、 Spring、 Spring jdbc 整合实例源码
Spring+Spring MVC+Spring JDBC+MySql实现简单登录注册
Spring mvc + Spring + Spring jdbc 整合实例源码
spring-jdbc-5.1.3.RELEASE-javadoc.jar 2018-11-27 10:05 1461865 spring-jdbc-5.1.3.RELEASE-javadoc.jar.asc 2018-11-27 10:05 475 spring-jdbc-5.1.3.RELEASE-javadoc.jar.md5 2018-11-27 10:05 32 spring-...
Phoenix Hbase springjdbc整合 demo Phoenix最早是saleforce的一个开源项目,后来成为Apache基金的顶级项目。 Phoenix是构建在HBase上的一个SQL层,能让我们用标准的JDBC APIs而不是HBase客户端APIs来创建表,插入...
开发工具 spring-jdbc-4.3.6.RELEASE开发工具 spring-jdbc-4.3.6.RELEASE开发工具 spring-jdbc-4.3.6.RELEASE开发工具 spring-jdbc-4.3.6.RELEASE开发工具 spring-jdbc-4.3.6.RELEASE开发工具 spring-jdbc-4.3.6....
Dwr+spring+JDBC 小例子,供分享
用spring4.0.5版本开发的,spring mvc,spring jdbc,最简单的用户登录,注册和修改的系统。适合初学者学习。
两个项目,一个项目是基于spring jdbc实现的分布式事务,一个是基于spring hibernate的分布式事务,hibernate项目里的applicationContext2.xml是基于mysql和mssql, applicationContext3.xml基于两个mssql, ...
Spring JDBC 增删改查
关于spring JDbc 的一个实例希望有所帮助 谢谢大家