1、resultMap中的id
在ibatis中为
<result column="id" jdbcType="BIGINT" property="id" />
在mybatis中为
<id property="id" column="id" />
2、别名
在ibatis中为
<typeAlias alias="app" type="com.aaa.bbb.App" />
在mybatis中为
<typeAliases>
<typeAlias alias="app" type="com.aaa.bbb.App" />
而是使用条件语句,if、choose, when, otherwise, trim, where, set
详见:http://www.mybatis.org/mybatis-3/zh/dynamic-sql.html
6、对于insert语句,如果要返回自增的id,insert语句需要
<insert id="insert" parameterType="app" useGeneratedKeys="true" keyProperty="id">
然后在java中通过app.getId()获得
或者
<insert id="insert" parameterType="app">
<selectKey keyProperty="id" resultType="long">
select LAST_INSERT_ID()
</selectKey>
insert into person(name,pswd) values(#{name},#{pswd})
</insert>
7、动态传入order by 参数形式:${param}
8、resultMap中,ibatis为class而mybatis为type
在ibatis中为
<result column="id" jdbcType="BIGINT" property="id" />
在mybatis中为
<id property="id" column="id" />
2、别名
在ibatis中为
<typeAlias alias="app" type="com.aaa.bbb.App" />
在mybatis中为
<typeAliases>
<typeAlias alias="app" type="com.aaa.bbb.App" />
</typeAliases>
3、在ibatis中的parameterClass对应mybatis中的 parameterType
4、在ibatis中的resultClass对应mybatis中的 resultType
而是使用条件语句,if、choose, when, otherwise, trim, where, set
详见:http://www.mybatis.org/mybatis-3/zh/dynamic-sql.html
6、对于insert语句,如果要返回自增的id,insert语句需要
<insert id="insert" parameterType="app" useGeneratedKeys="true" keyProperty="id">
然后在java中通过app.getId()获得
或者
<insert id="insert" parameterType="app">
<selectKey keyProperty="id" resultType="long">
select LAST_INSERT_ID()
</selectKey>
insert into person(name,pswd) values(#{name},#{pswd})
</insert>
7、动态传入order by 参数形式:${param}
8、resultMap中,ibatis为class而mybatis为type