ibatis

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.analyst.mapper.UserMapper.queryUser

橙三吉。 提交于 2019-11-29 00:22:54
如果出现:   org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上。 按以下步骤一一执行: 1、检查xml文件所在的package名称是否和interface对应的package名称一一对应 2、检查xml文件的namespace是否和xml文件的package名称一一对应 3、检查函数名称能否对应上 4、去掉xml文件中的中文注释 5、随意在xml文件中加一个空格或者空行然后保存 注意:在使用IDEA开发时,如果打包时*Mapper.xml没有自动复制到class输出目录的mapper类包下,则需要在pom文件中添加mybatis加载配置文件的配置! <resources><resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>true</filtering></resource><resource> <directory>src/main/resources</directory><

好程序员Java教程分享几个流行的Java框架

半世苍凉 提交于 2019-11-28 22:58:41
  好程序员Java教程分享几个流行的Java框架 一.springmvc框架 简介:SpringWebMVC是一种基于Java的实现了WebMVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模型,框架的目的就是帮助我们简化开发,SpringWebMVC也是要简化我们日常Web开发的。 优点: 1.调理清晰,控制器(controller)、验证器(validator)、命令对象(commandobect)、表单对象(formobject)、模型对象(modelobject)、Servlet分发器(DispatcherServlet)、处理器映射(handlermapping)、试图解析器(viewresoler)等等,让你学习时能层次分明。 2、分工明确,而且扩展点相当灵活,可以很容易扩展,虽然几乎不需要; 3、由于命令对象就是一个POJO,无需继承框架特定API,可以使用命令对象直接作为业务对象; 4、和Spring其他框架无缝集成,是其它Web框架所不具备的; 5、可适配,通过HandlerAdapter可以支持任意的类作为处理器; 6、可定制性,HandlerMapping、ViewResolver等能够非常简单的定制; 7、功能强大的数据验证、格式化、绑定机制; 8

好程序员Java教程分享几个流行的Java框架

你说的曾经没有我的故事 提交于 2019-11-28 22:54:47
  好程序员Java教程分享几个流行的Java框架 一.springmvc框架 简介:SpringWebMVC是一种基于Java的实现了WebMVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行职责解耦,基于请求驱动指的就是使用请求-响应模型,框架的目的就是帮助我们简化开发,SpringWebMVC也是要简化我们日常Web开发的。 优点: 1.调理清晰,控制器(controller)、验证器(validator)、命令对象(commandobect)、表单对象(formobject)、模型对象(modelobject)、Servlet分发器(DispatcherServlet)、处理器映射(handlermapping)、试图解析器(viewresoler)等等,让你学习时能层次分明。 2、分工明确,而且扩展点相当灵活,可以很容易扩展,虽然几乎不需要; 3、由于命令对象就是一个POJO,无需继承框架特定API,可以使用命令对象直接作为业务对象; 4、和Spring其他框架无缝集成,是其它Web框架所不具备的; 5、可适配,通过HandlerAdapter可以支持任意的类作为处理器; 6、可定制性,HandlerMapping、ViewResolver等能够非常简单的定制; 7、功能强大的数据验证、格式化、绑定机制; 8

mybatis分页的一种解决方案

时间秒杀一切 提交于 2019-11-28 22:14:45
mybatis自定义分页解决方案 1、PageSqlProvider<T> —— 提供默认的分页列表查询 package com.xinyartech.erp.core.base; import com.xinyartech.erp.core.dto.page.PageDTO; /** * Provider默认抽象实现 * * @author Lynch */ public abstract class PageSqlProvider<T> { /** * 分页sql语句,注意:最外层显示字段不能包含子查询 * * @return * @author Lynch */ protected abstract String preSql(PageDTO<T> pageDto); /** * 分页列表查询 * * @param pageDto * @return * @author Lynch */ public String findAll(PageDTO<T> pageDto){ return preSql(pageDto); } /** * 统计分页总条数 * * @return * @author Lynch */ public String countAll(PageDTO<T> pageDto){ String sql = preSql(pageDto); String

Unable to convert MySQL date/time value to System.DateTime

柔情痞子 提交于 2019-11-28 21:34:36
I am using ibatis and C#. i get a result from a select query that has CreatedDate as one of the field. The Datatype of CreatedDate in Mysql is Date. I assign the result set of the select query to a Ilist< DeliveryClass>. Here the DeliveryClass CreatedDate as DateTime. When i run the application, i get Unable to convert MySQL date/time value to System.DateTime . What could be the problem? The problem in the format, actually mysql have a different format (yyyy-mm-dd) for the date/time data type and to solve this problem use the mysql connector library for .net from here http://dev.mysql.com

Oracle SQL DATE conversion problem using iBATIS via Java JDBC

旧城冷巷雨未停 提交于 2019-11-28 21:30:33
问题 I'm currently wrestling with an Oracle SQL DATE conversion problem using iBATIS from Java. Am using the Oracle JDBC thin driver ojdbc14 version 10.2.0.4.0. iBATIS version 2.3.2. Java 1.6.0_10-rc2-b32. The problem revolves around a column of DATE type that is being returned by this snippet of SQL: SELECT * FROM TABLE(pk_invoice_qry.get_contract_rate(?,?,?,?,?,?,?,?,?,?)) order by from_date The package procedure call returns a ref cursor that is being wrapped in a TABLE to where is then easy to

打开iBatis显示运行sql语句

徘徊边缘 提交于 2019-11-28 17:56:52
将ibatis log4j运行级别调到DEBUG可以在控制台打印出ibatis运行的sql语句,方便调试: log4j.logger.com.ibatis=DEBUG log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG log4j.logger.java.sql.Connection=DEBUG log4j.logger.java.sql.Statement=DEBUG log4j.logger.java.sql.PreparedStatement=DEBUG 来源: https://www.cnblogs.com/yuhuameng/p/11417764.html

Howto return ids on Inserts with Ibatis ( with RETURNING keyword )

懵懂的女人 提交于 2019-11-28 17:38:47
I'm using iBatis/Java and Postgres 8.3. When I do an insert in ibatis i need the id returned. I use the following table for describing my question: CREATE TABLE sometable ( id serial NOT NULL, somefield VARCHAR(10) ); The Sequence sometable_id_seq gets autogenerated by running the create statement. At the moment i use the following sql map: <insert id="insertValue" parameterClass="string" > INSERT INTO sometable ( somefield ) VALUES ( #value# ); <selectKey keyProperty="id" resultClass="int"> SELECT last_value AS id FROM sometable_id_seq </selectKey> </insert> It seems this is the ibatis way of

MyBatis/iBatis - reusable sql fragments in a separate SQL Map file?

前提是你 提交于 2019-11-28 16:32:36
问题 I would like to put sql fragments used by several of my SQL Map XML files in a separate file. At the moment, the <sql> elements with these fragments are in one of the mappers together with other elements like <select> , which makes them hard to find. Can I have a mapper that defines just a few <sql> elements and is not used to generate an implementation to an interface? What would be the correct namespace of this mapper? This is the SQL Map file with the framents: <mapper namespace="com

Pass and return custom array object in ibatis and oracle in java

你说的曾经没有我的故事 提交于 2019-11-28 11:20:51
I've looked around for a good example of this, but I haven't run into one yet. I want to pass a custom string array from java to oracle and back, using the IBATIS framework. Does anyone have a good link to an example? I'm calling stored procs from IBATIS. Thanks You've got to start with a custom instance of TypeHandler . We'd prefer to implement the simpler TypeHandlerCallback , but in this scenario we need access to the underlying Connection . public class ArrayTypeHandler implements TypeHandler { public void setParameter(PreparedStatement ps, int i, Object param, String jdbcType) throws