mybatis调用mysql存储过程,得到null,求帮助

Dao层

 int instertUserWeight(@Param("_uid") Integer uid,@Param("_gid") Integer gid,@Param("_count") Long count,@Param("_result") Integer result);

Mapping层

<select id="instertUserWeight" parameterType="map" statementType="CALLABLE" resultMap="BaseResultMap">
    {CALL proc_BetWeightSave(
      #{_uid,mode=IN,jdbcType=INTEGER},
      #{_gid,mode=IN,jdbcType=INTEGER},
      #{_count,mode=IN,jdbcType=BIGINT},
      #{_result,mode=OUT,jdbcType=INTEGER}
    )}
  </select>

存储过程
图片说明
运行结果是2
可是我用mybatis调用的时候拿到的是null
attempted to return null from a method with a primitive return type (int).

** 求帮助**

2个回答

这个问题是由resultmap造成的,应该改成resulttype
,好吧还是自己解决了

v_Cloud
v_Cloud 我和他应该不是同个错误吧
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Mybatis调用MySQL存储过程
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010046908/article/details/69944959 1.存储过程的简介 ...
MyBatis调用Mysql存储过程
&amp;lt;!-- 删除用户 【存储过程】--&amp;gt; &amp;lt;delete id=&quot;delUser&quot; parameterType=&quot;java.lang.String&quot; statementType=&quot;CALLABLE&quot;&amp;gt; { call proc_del_user(#{userId}) } &amp;lt;/delete&amp;gt;就多了个参数:statementType=&quot;CALLA
mybatis调用MySQL存储过程
一、建表 CREATE TABLE test.t_sequence (   name varchar(50) NOT NULL COMMENT 'sequence名称',   currentvalue bigint(20) NOT NULL COMMENT 'sequence当前值',   increment int(10) NOT NULL COMMENT 'sequence每次增长
MyBatis调用MYSQL存储过程
MyBatis调用MYSQL存储过程 返回多行 引用的包: asm-3.1.jar cglib-2.2.jar commons-logging-1.1.1.jar log4j-1.2.13.jar mybatis-3.0.4.jar mysql-connector-java-5.1.13.jar slf4j-api-1.5.8.jar slf4j-log4j12-1.5.8.jar
mybatis调用mysql存储过程
mybatis调用mysql中的存储过程方法详解
mybatis调用mysql存储过程时报错
rn rn rn rn rn rn rn rn rn rn CALL pro_getChildList(rn #pId,jdbcType=VARCHAR,mode=IN,rn #colName,jdbcType=VARCHAR,mode=IN,rn #colPname,jdbcType=VARCHAR,mode=IN,rn #tName,jdbcType=VARCHAR,mode=IN,rn #outColName,jdbcType=VARCHAR,mode=IN,rn #retVal,jdbcType=VARCHAR,mode=OUT,rn #userCount,jdbcType=INTEGER,mode=OUTrn )rn rn 在本机跟测试mysql 5.6.36中可以正常运行,但放到生产环境中,mysql版本为5.6.44时会抛出错误rn rnstd [0523 14:45:27 ERROR: druid.sql.Statement - conn-10020, cstmt-20014 execute error. CALL pro_getChildList(rn ?,rn ?,rn ?,rn ?,rn ?,rn ?,rn ?rn )rn com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)rn at com.mysql.jdbc.Util.getInstance(Util.java:382)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)rn at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)rn at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)rn at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)rn at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67)rn at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)rn at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)rn at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)rn at com.sun.proxy.$Proxy38.selectOne(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)rn at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId()rn at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java)rn at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)rn at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)rn at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)rn at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)rn at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)rn at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rnstd [0523 14:45:27 ERROR: com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 172.21.4.80. service: com.concom.yunzq.service.user.IDepartmentService, method: queryChildDeptAndCountByParentId, exception: org.springframework.jdbc.BadSqlGrammarException: rn### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml]rn### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMaprn### The error occurred while setting parametersrn### SQL: CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )rn### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1, dubbo version: 2.8.4, current host: 172.21.4.80rnorg.springframework.jdbc.BadSqlGrammarException: rn### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml]rn### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMaprn### The error occurred while setting parametersrn### SQL: CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )rn### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)rn at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)rn at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)rn at com.sun.proxy.$Proxy38.selectOne(Unknown Source)rn at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)rn at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)rn at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)rn at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke()rn at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)rn at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652)rn at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId()rn at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java)rn at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)rn at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)rn at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)rn at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)rn at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)rn at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)rn at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)rn at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)rn at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)rn at java.lang.Thread.run(Thread.java:748)rnCaused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)rn at com.mysql.jdbc.Util.getInstance(Util.java:382)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)rn at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)rn at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)rn at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)rn at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)rn at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)rn at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)rn at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67)rn at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)rn at com.sun.proxy.$Proxy224.query(Unknown Source)rn at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)rn at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)rn at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)rn at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)rn at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)rn ... 40 more
mybatis调用mysql存储过程,带结果集
存储过程中经常需要返回结果集。 MySQL 中直接用 select 即可返回结果集。而 Oracle 则需要使用游标来返回结果集。这一点 MySQL 相对比较方便,如下代码即可实现输出结果集: mybatis调用service层需要注意增加 @Transactional(readOnly = false),放开事务写功能service@Transactional(readOnly = false)
MyBatis:MyBatis操作MySQL存储过程
MyBatis:MyBatis操作MySQL存储过程 一 . 数据库中创建存储过程,并查看创建结果 1.创建存储过程 DROP procedure IF EXISTS net_procedure_request; DELIMITER $$ CREATE procedure net_procedure_request(in select_type varchar(99),in select_cli...
求c++ 调用mysql存储过程的方法
再用mysql存储过程,网上用c api调用的例子比较少rn请问谁有一些调用例子,不胜感激,谢谢
mybatis调用mysql存储过程并获取返回值
1、mysql创建存储过程 #结束符号默认;, delimiter $$语句表示结束符号变更为$$ delimiter $$ CREATE PROCEDURE `demo`(IN idno VARCHAR(100), out str VARCHAR(4000)) BEGIN SET str = ''; set str = concat(str, "SELECT count(DISTINCT `pe...
C#调用mysql存储过程出现奇葩问题,求帮助
[img=https://img-bbs.csdn.net/upload/201507/24/1437729772_352800.jpg][/img]rnrn存储过程rnrnDROP PROCEDURE IF EXISTS `proc_QryTid`; rnCREATE PROCEDURE proc_QryTid(IN pTID VARCHAR(50),OUT ifExist INT) rnBEGIN rn select count(*) into ifExist from tid_record where TID=pTID;rnEND ; rnrnCALL proc_QryTid('E280 1130 2000 1002 68E8 00A9',@a);rnselect @a;rnrnrn[img=https://img-bbs.csdn.net/upload/201507/24/1437729884_729701.jpg][/img]rnrnrnC# 程序中调用代码rn public String Proc_QryToTID(String TID)rn rn String result = "0";rn tryrn rn mysqlConnection.Open();rn MySqlCommand mysqlCommand = new MySqlCommand("proc_QryTid", mysqlConnection);rn mysqlCommand.CommandType = CommandType.StoredProcedure;rnrn mysqlCommand.Parameters.Add("@pTID", MySqlDbType.VarChar).Value = TID;rn mysqlCommand.Parameters["@pTID"].Direction = ParameterDirection.Input;rnrn mysqlCommand.Parameters.Add("@ifExist", MySqlDbType.Int32).Value = 0;rn mysqlCommand.Parameters["@ifExist"].Direction = ParameterDirection.Output;rnrn mysqlCommand.ExecuteNonQuery();rnrn result = mysqlCommand.Parameters["@ifExist"].Value.ToString();rn return result;rn rnrn catch (MySqlException ex)rn rn Console.WriteLine("MySqlException Error:" + ex.ToString());rn if (Regex.IsMatch(ex.ToString(), ""))rn rn MessageBox.Show("查询TID失败");rn rn return result;rn rn finallyrn rn mysqlConnection.Close();rn rn rnrnrn[img=https://img-bbs.csdn.net/upload/201507/24/1437730061_407110.jpg][/img]rnrn这个结果怎么会是 1 !!!! 无论怎么查,有还是没有结果都是 1 ????rn但是在数据库里面 直接调用 就没问题,有没有大侠解惑rn
MyBatis 调用MySql存储过程处理树形结构结果集
背景在做部门管理的时候,部门可以有父部门和子部门,这是个典型的树形结构。在选择一个部门的父部门时需要排除其所有子部门。如A12的可选父部门就是红圈外的所有部门。 框架mybatis 3.2.8 mysql 5.7 springMVC 由于mybatis中没有oracle中那么多省力的函数,我需要拿到所有可选父部门的id,名称,父部门名称,送到前端用zTree显示。所以需要手写存储过程去拿到结果集再组
mysql存储过程+mybatis调用返回多条数据
大致流程是在mysql中新建一个存储过程然后DELIMITER$ create PROCEDURE jysapp.get_second_member(IN user_id int) BEGIN SELECT id,username,phonenum,registertime,str1 FROM jysapp.user where user.pid = user_id; end mybatis中的
mybatis 调用mysql存储过程 带输出输入参数
首先感谢网络上以为朋友。其实我不认识。看到他的博客才做出来。 http://lohasle.iteye.com/blog/1669879 他的地址。下面的是我一些简单拓展的     存储过程都是一样的,只是根据自己的喜好,可以用MAP或者JAVABEAN传递参数。 Sql代码   -- --------------------------------------------------...
Mysql存储过程调用
前言 博主github 博主个人博客http://blog.healerjean.com 准备数据 CREATE TABLE `demo_entity` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, `age` bigint(20) DEF...
MyBatis,MySql存储过程分页查询
前言一般我们使用MyBatis时进行分页主要通过使用PageHelper这个插件。但某些时候,在某些公司可能会遇到跨库查询并分页显示的场景,这时就无法在使用PageHelper了。如果待查询的MySql不同库在一台机器上那么可以通过 数据库名.表明 的形式来进行跨库查询,这是可以通过存储过程来完成查询。 编写存储过程 以学生信息查询为例,例如有两个库。 学生库student(学生信息表 stu_i
mybatis操作mysql存储过程
之前没有用mybatis操作mysql存储过程,一般都是用ibatis操作oracle存储过程,两者的差距还是蛮大的,mysql的存储过程语法和oracle都不一样。以下为代码片断(spring MVC+mybatis+MySQL): package com.letu.dao; import java.util.List; import java.util.Map; impor...
mySQL存储过程调用
php中调用MySQL存储过程示例
【Mybatis学习】Mybatis学习之调用Mysql存储过程(1传入2输出)
Mybatis调用MySql中的存储过程(1传入2输出)1.定义存储过程目标数据库表结构:存储过程:直接用语句执行总出现错误,暂时没解决,大致如下:CREATE OR REPLACE PROCEDURE findByUname(uname VARCHAR(255),OUT sid INT,OUT rname VARCHAR(255)) BEGIN SELECT id,real_name i...
调用mysql存储过程
public DataTable selectAllPerson() rn rnstring constr = "UserId=root;Host=localhost;Database=test;password=1234"; rnMySqlConnection conn = new MySqlConnection(constr); rnMySqlDataAdapter sda=new MySqlDataAdapter(); rnsda.SelectCommand =new MySqlCommand("sp_Select(存储过程名称)",conn); rnDataSet ds = new DataSet(); rnsda.Fill(ds,"T_User"); rnreturn ds.Tables["T_User"]; rnrn rnrnrnpublic DataTable selectAllPerson() rn rnstring constr = "UserId=root;Host=localhost;Database=test;password=1234"; rnMySqlConnection conn = new MySqlConnection(constr); rnMySqlDataAdapter sda=new MySqlDataAdapter(); rnsda.SelectCommand =new MySqlCommand("select * fromT_User",conn); rnDataSet ds = new DataSet(); rnsda.Fill(ds,"T_User"); rnreturn ds.Tables["T_User"]; rnrn rn为什么上面这个程序执行会出错?
mybatis 中 使用MYSQL存储过程
#mybatis 中 使用MYSQL存储过程; ##1.有学生表student(id,name,age,money) ##2.创建查询学生表信息的存储过程: ``` delimiter | create Procedure showAllstu() BEGIN SELECT * FROM student ORDER BY id DESC LIMIT 6; EN...
mybatis对mysql存储过程的处理
由于前一段时间公司特别的忙,所以博客就没有继续更新了。现在有点空闲的时间了,想记录下mybatis的存储过程的用法.在之前mybatisplus升级到2.14了,他所带来的的特性很强大,可以实现了对象关系型的操作,和hibernate的很相识,他是mybatis的增强版,有兴趣的可以到他官网去逛逛,我之前用过,很爽。现在进入正题,我们都知道,减库存以及加库存是一个同步的过程,一方处理失败就得回滚的
Mybatis应用mysql存储过程查询数据
1.创建mysql存储过程,这是个复杂查询加上了判断,比较复杂 CREATE PROCEDURE searchAllList ( IN tradingAreaId VARCHAR (50), IN categoryName VARCHAR (100), IN intelligenceSort TINYINT UNSIGNED, IN priceBegin DOUBLE, IN pric
MyBatis使用MySQL存储过程
1、项目结构2、创建存储过程3、在StudentMapper.xml文件里配置映射语句&amp;lt;select id = &quot;callById&quot; resultMap = &quot;result&quot; parameterType = &quot;Student&quot; statementType = &quot;CALLABLE&quot;&amp;gt; {call read_recordById(#{id, jdbcType = INTEGER, ...
求mysql存储过程
各位大佬们,我最近遇到要求写存储过程,这个完全不会,请大佬们指导一下:rnrn给个例子就行:大概是这样的:rnrn我先查一个表的结果集(是一个list) :rnrn然后用这个结果集的ID循环去查询另外的数据表rnrn最后用查到的数据计算得到结果,再插入另外一个表:rnrn附上java代码:rnrnList proList = new ArrayList();rn proList = uiProDao.queryProject(0);// 0默认查询所有项目rn if (proList != null && proList.size() > 0) rn for (int i = 0; i < proList.size(); i++) rn Project pro = proList.get(i);rn UiProCount uipro = new UiProCount();rn float proincome = 0;// 项目总收入rn int sales = uiProDao.getProSales(countDate,pro.getId());rn int result = uiProDao.addProCount(sales);// 如果没有数据则插入rn rn rn
winform程序调用MYsql存储过程出错!求指教!
[code=C#]rn int CurrentPage, PageCount;//当前页,总页rn int PageSize = 20;//每页显示的数rn private void PageBackBase()rn rn tryrn rn if (CurrentPage < 1)rn rn CurrentPage = 1;rn rnrn MySqlConnection sqlConn = new MySqlConnection(Public.ClassPublic.strConn);rn sqlConn.Open();rn MySqlCommand sqlCmd = new MySqlCommand("pr_pager", sqlConn);rn sqlCmd.CommandType = CommandType.StoredProcedure;rn sqlCmd.Connection = sqlConn;rn MySqlParameter[] prams =rn new MySqlParameter("@p_table_name",MySqlDbType.VarChar,1024),/*表名*/rn new MySqlParameter("@p_fields",MySqlDbType.VarChar,1024),/*查询字段*/rn new MySqlParameter("@p_page_size",MySqlDbType.Int64),//每页记录数rn new MySqlParameter("@p_page_now",MySqlDbType.Int64),//当前页rn new MySqlParameter("@p_order_string",MySqlDbType.VarChar,128),//排序条件(包含ORDER关键字,可为空)*/rn new MySqlParameter("@p_where_string",MySqlDbType.VarChar,1024),/*WHERE条件(包含WHERE关键字,可为空)*/rn new MySqlParameter("@p_out_rows",MySqlDbType.Int64);/*输出记录总数*/rn prams[0].Value = "t_CapTrue";//表名rn prams[1].Value = " * ";//字段名rn prams[2].Value = PageSize;rn prams[3].Value = CurrentPage;rn prams[4].Value = "order by SN";rn prams[5].Value = " ";rn prams[6].Direction = ParameterDirection.Output;//返回总页数rn foreach (MySqlParameter pram in prams)rn rn sqlCmd.Parameters.Add(pram);rn rnrn DataSet ds = new DataSet();rn MySqlDataAdapter da = new MySqlDataAdapter();rn da.SelectCommand = sqlCmd;rn da.Fill(ds);rn sqlConn.Close();rn PageCount = (int)sqlCmd.Parameters["@p_out_rows"].Value;rnrn this.txtPage.Text = CurrentPage.ToString() + "/" + PageCount.ToString();rn this.dtShowMonitor.DataSource = ds.Tables[0];rn rn catch (Exception ex)rn rnrn MessageBox.Show(ex.Message);rn rn[/code]rn错误是值对于无符号的字节太大或者太小
关于Mybatis 使用MySql存储过程的问题
mybatis 通过xml方式使用mysql的存储过程,在本地测试的时候一切正常,但是放到服务器上执行的sql语句就变了rn在本地测试的时候执行的是 call p_mishi_selectFavoriteList(?) rn在服务器上就变成了 select count(0) from (call p_mishi_selectFavoriteList(?)) tmp_countrn请问各位大神知道是什么问题么?rnrn一下是配置rnrn call p_mishi_selectFavoriteList(#userid,jdbcType=BIGINT,mode=IN)rnrnrn rn rn rn rn rn rn rnrnrn调用: List favList = favoriteMapper.selectFavoriteList(userId);
帮助编写一个简单mysql存储过程
创建一个带参数存储过程myp ( par1 varchar(100))rnbeginrnrnend;rnrn参数par1 为用逗号分隔的字符串 例如: name1,name2,name3rnrn现需要把par1中逗号前的字符串,都插入表user 中rnsql :rninsert user() value('name1');rninsert user() value('name2');rninsert user() value('name3');rnrn请问在存储过程中如何去解析字符,进行叠代插入表?
为什么在线程中调用AfxGetMainWnd()得到NULL?
DWORD WINAPI TestTherad(LPVOID lpParam)rnrn CWnd *pMainWnd = AfxGetMainWnd(); //线程方式返回NULLrnrn return 0;rnrnrnvoid CFuncInThreadView::OnLButtonDown(UINT nFlags, CPoint point)rnrn // 1、线程方式rn DWORD dwThreadId;rn HANDLE hHandle;rn hHandle = CreateThread(NULL,0,TestTherad,NULL,0,&dwThreadId);rn WaitForSingleObject(hHandle,INFINITE);rn CloseHandle(hHandle);rnrn // 2、函数方式rn //TestTherad(NULL);rnrn CView::OnLButtonDown(nFlags, point);rnrn用线程方式得到NULL,用函数调用方式是正常的,这是为什么啊?rn
PHP调用MYSQL存储过程
存储过程是rnCREATE DEFINER = `root`@`localhost` PROCEDURE `testPrc`(IN UserID int)rnBEGINrnrnselect user_name from user WHERE user_id = UserID ;rnEND;rnrnrn在PHP里面为什么获取不到user_namernrn $rs = $conn->Execute( "call testPrc(17)");rnecho " ";
jfinal调用mysql存储过程
首先写一个内部类并实现ICallback接口: class CallbackTest implements ICallback { public String areaCodes;//传入参数 public List&amp;lt;Record&amp;gt; list;//返回值 @Override public Object call(Connection conn) throws SQ...
Java调用Mysql存储过程
Java调用Mysql存储过程,Mysql存储过程源代码在该项目根目录下。
vc 调用带参数的mysql存储过程
无论怎么写都是报错。。rnrn我想实现vc 调用mysql存储过程,带一个参数,一个实例是带字符串类型参数,一个实例是带整型参数。rn大神们看看我的代码:rnrn存储过程定义:rnCREATE PROCEDURE ( in rroomnum varchar(30))rn beginrn select * from client_infor,enter_infor where roomnum=rroomnum and client_infor.id=enter_infor.id;rnendrnrn令一个:rnCREATE PROCEDURE ( in rroomnum int)rn beginrn select * from client_infor,enter_infor where roomnum=rroomnum and client_infor.id=enter_infor.id;rnendrnrnrn[code=C/C++]rnrnstrSQL.Format("call cdd(%s)",m_roomnum);rnmysql_real_query(&mysql,(char*)(LPCTSTR)strSQL,(UINT)strSQL.GetLength())rnrnrn另一个:rnint i=atoi(m_roomnum);rnstrSQL.Format("call cdd(%d)",i);rnmysql_real_query(&mysql,(char*)(LPCTSTR)strSQL,(UINT)strSQL.GetLength())rnrn[/code]rnrn
java调用mysql存储过程的问题
我想用java调用mysql的存储过程,mysql存储过程支不支持输出参数是cursor类型的(oracle支持),如果支持怎么做呢?
Java调用mysql存储过程
先Mark下: https://technicalsearch.iteye.com/blog/1433293 https://blog.csdn.net/boonya/article/details/8592342
MySQL存储过程的创建和调用
Mysql存储过程弱爆了,很多莫名其妙的规则。下面这个创建代码,任何地方不匹配都报错,包括空格!DELIMITER // create procedure authappkey(in p1 varchar(32), in p2 varchar(32), in p3 varchar(32), in p4 varchar(45), out p5 int) begin -- 权限检查 -- p1:项...
关于调用mysql存储过程的问题
请问,如何在jsp下,调用mysql的存储过程,语法是什么样的,谢谢!
急求帮助:null转空值
假设我的存储过程有3个参数,我用1个textbox传送了一个是指定的值“abc”,另外2个textbox的值是空的,提交上去后,sql数据库表中显示:rn字段1 字段2 字段3rn abc null nullrnrn我现在需要2个空的textbox传上去的值是空的,而不是显示null,即:rn字段1 字段2 字段3rnabc rnrn问如何解决,麻烦各位高手解答一下,小弟先谢谢了。
Java实现mysql存储过程调用
前言:之前用的是VS+SQL Server 现在用的是Myeclipse+Mysql。能实现心里还是挺兴奋的。 存储过程优点: 1、存储过程增强了SQL语言的功能和灵活性。 2、存储过程被创建后,可以在程序中被多次调用,而不必重新编写该存储过程的SQL语句。 3、存储过程能实现较快的执行速度。 4、存储过程能过减少网络流量。 优点知道就可以了,不必一字不差的背过,下面来看看如何实战吧!
TADOStoredProc调用MYSql存储过程问题
TADOStoredProc调用MYSql存储过程,怎么老是报错,难道不兼容。rn1.rnProc.Parameters.Items[Index].Value := Value;rn2.rnproc.Parameters.ParameterByName().value := value;rnrn以上两种方式调用都有问题。
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池