ibatis

DotNet中的数据持久层框架

坚强是说给别人听的谎言 提交于 2020-01-15 08:49:56
下面是DotNet中的数据持久层框架(ORM,半ORM等)的列表: .NET Persistence BBADataObjects DataObjects.NET Data Tier Modeler for .NET DotNorm Eldorado.NET Enterprise Core Objects (ECO™) Entity Broker eXpress Persistent Objects for .NET FastObjects.NET JC Persistent Framework LLBLGen Pro ModelWorks Nhibernate Nolics.NET Norm Norpheme ObjectBroker ObjectSpaces ObjectSpark Objectz.NET OJB.NET OPF.Net (Object Persistent Framework) ORM.NET Pragmatier Data Tier Builder RapTier Sisyphus Persistence Framework TierDeveloper Bob.NET ObjectPersistor.NET Genome Ibatis easyobjects 这么多的框架成熟的不多,各自的设计理念也不太一样。这些框架里我了解的不多。

How to map query for iBATIS with parameterized column in select clause?

房东的猫 提交于 2020-01-14 18:58:19
问题 I want to have a method that finds a certain value from a column of a particular table in the database, where the name of the column is passed in as a parameter. So the Java method would have the following signature: public Integer getFoo(String column) throws DataAccessException; My attempted mapping for this query is the following: <select id="getFoo" parameterClass="java.lang.String" resultClass="java.lang.Integer"> select min($column$) from daily_statistics where $column$ > 0 </select>

Collections of different types inherited from a single object vs a single collection of super object [closed]

心已入冬 提交于 2020-01-14 06:38:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Imagine the following scenario. class Shape { // methods of Class Shape } class Circle extends Shape { // methods of Class Shape // methods of Class Circle } class Square extends Shape { // methods of Class Shape // methods of Class Square } class Canvas // This class should a

How does the mybatis parameter replacement work in @SelectProvider

断了今生、忘了曾经 提交于 2020-01-13 12:06:53
问题 I've in inherited some code that I'm trying to understand and any searching I do to find something on @SelectProvider turns up a whole lot of nothing. Java DAO @SelectProvider(type = CategoryDaoSelectProvider.class, method = "findByParentIdAndName") Category findByParentIdAndName(@Param("parentId") Long parentId, @Param("name") String name); Select Provider public class CategoryDaoSelectProvider { public static String findByParentIdAndName(Map<String, Object> params) { Long parentId = (Long

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2

北战南征 提交于 2020-01-12 22:55:31
在配置mybatis操作数据库的时候会出现: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2 这是因为查询结果的期望一条或者为空,但是实际上返回的记过有两条。就是说数据表中有多条数据的,自己期望的获取到的数据和操作数据库时,返回的数据的条数不对应导致的。 解决:   1、检查操作数据库的配置文件返回的类型是否和java中的返回类型一致   2、检查 resultType 或resultMap中的数据类型是否和接口中的一致   3、 检查传递的参数的个数   4、检查数据库的数据是否有错误 基本的一些错误,可能还有很多错误是出现这个bug的,遇到了在总结   来源: https://www.cnblogs.com/huangcan1688/p/12182129.html

When to use $ vs #?

≡放荡痞女 提交于 2020-01-09 09:04:28
问题 I am confused about using $ vs # . I didn't found any guides for this. I used them as name = #{name} , name like '%${word}%' , order by name ${orderAs} , where name = #{word} Sometimes , these are work fine but at the sometimes , parameters aren't included or gave me error like org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'name'....... So, I'd like to know when to use $ or # ? 回答1: Following the myBatis guidelines #{} is used in your sql statements.

MyBatis源码的学习(21)---mybatis中当参数只有一个且是自定义对象类型时提示reflection.ReflectionException: There is no getter

陌路散爱 提交于 2020-01-09 01:03:04
Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class learn.User' ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class learn.User' 主要原因是,复制代码的时候,入参那里将@Param注解去掉后,结果仍然使用 #{user.userCode}的方式获取值。 下面是正确的示例代码: package learn; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.session.RowBounds; import java.util.List; public interface UserMapper { public User selectUser(String id); public User

异常记录——使用Mybatis报BindingException

北慕城南 提交于 2020-01-08 14:44:17
异常信息 org.apache.ibatis.binding.BindingException nested exception is org.apache.ibatis.binding.BindingException: Parameter 'deviceNO' not found. Available parameters are [deviceNo, deviceId, param1, param2] 场景回溯 业务场景:车辆表,需要更新指定编号车辆的设备Id(编号和设备ID均非主键),因而在对应的mapper.xml中自定义了SQL语句,结果调用对应接口时爆出异常 当然可以直接使用Mybatis-plus的EntityWrapper,这样做虽然方便,但是第一影响性能,第二造成职责划分不清(SQL的拼装属于dao层,它从来就不该在Service层完成) 原因排查 apache的ibatis将原因说的很清楚:Parameter 'deviceNO' not found. Available parameters are [deviceNo, deviceId, param1, param2] ,没找到xml里使用占位符表示的参数(#{deviceNO}),能用的参数有deviceNo、deviceId等,很明显是发生了拼写错误 xml: Mapper接口:

Is there a setting change we need to make for iBatis to MyBatis conversion tool?

泪湿孤枕 提交于 2020-01-07 03:11:14
问题 Has anyone used the iBatis to MyBatis conversion tool like in https://code.google.com/p/mybatis/wiki/DocUpgrade3? Did you need to make a setting change for the tool to work? I've tried 2-3 versions of this tool, but I keep getting this error: [xslt] Loading stylesheet C:\<some-path>\migrate.xslt [xslt] : Error! Connection timed out: connect [xslt] : Error! com.sun.org.apache.xml.internal.utils.WrappedRuntimeExcepti on: Connection timed out: connect [xslt] Failed to process null BUILD FAILED C

MyBatis的注解开发

馋奶兔 提交于 2020-01-06 18:58:36
单表的CRUD注解开发: User实体类: package com.zyb.pojo; import java.io.Serializable; import java.util.Date; public class User implements Serializable { private Integer id; private String username; private String sex; private String address; private Date birthday; public User() { } @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", sex='" + sex + '\'' + ", address='" + address + '\'' + ", birthday=" + birthday + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; }