SqlMapClientTemplate SqlMapClient] 区别

本文详细阐述了IBATIS框架中SqlMapClient与SqlMapClientTemplate的区别,强调了使用SqlMapClientTemplate的好处,包括session的封装和异常捕捉,确保了session操作的一致性和异常处理的统一性。
IBATIS[SqlMapClientTemplate SqlMapClient] 区别 2011-03-07 16:17:19| 分类: 工作 | 标签:工作 |字号大中小 订阅 .

SqlMapClientTemplate是SqlMapClient的封装类.
SqlMapClient中包含着session的管理.
SqlMapClientTemplate用于session的封装,以及异常的捕捉.
所以按照以上的推断来说.应该尽量使用SqlMapClientTemplate.
保证session以及Exception的正常以及统一.
org.springframework.dao.DuplicateKeyException: SqlMapClient operation; --- The error occurred while applying a parameter map. --- Check the prop_kfc_insured.ibatorgenerated_updateByExampleSelective-InlineParameterMap. --- Check the statement (update failed). --- Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '7' for key 'prop_kfc_insured.PRIMARY'; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred while applying a parameter map. --- Check the prop_kfc_insured.ibatorgenerated_updateByExampleSelective-InlineParameterMap. --- Check the statement (update failed). --- Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '7' for key 'prop_kfc_insured.PRIMARY' at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:206) at org.springframework.orm.ibatis.SqlMapClientTemplate.update(SqlMapClientTemplate.java:381) at com.eagle.platform.base.api.dao.BasicDAOImpl.updateObject(BasicDAOImpl.java:80) at com.eagle.insure.db.base.dao.PropBaseDaoImpl.updateObject(PropBaseDaoImpl.java:62) at com.eagle.insure.db.dao.impl.PropKfcInsuredDAOImpl.updateByExampleSelective(PropKfcInsuredDAOImpl.java:111) at com.eagle.insure.db.dao.impl.PropKfcInsuredDAOImpl$$FastClassBySpringCGLIB$$ea1d584e.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(
11-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值