Skip to content

《MyBatis从入门到精通》(刘增辉)一书中,第159页有错误。 #39

Description

@dear-Alice-moon
刘增辉老师,你好。

在你写的《MyBatis从入门到精通》一书中,第159页有错误。

在一对多映射中,resultMap标签中的子标签 collection 应使用 ofType属性来进行映射 sysRole 实体类。

`

<resultMap id="userRoleListMap" extends="sysUserMap" type="com.moon.mybatis.pojo.SysUser2"> 
	<id property="id" column="id" />
	<result property="userName" column="user_name"/>
	<result property="userPassword" column="user_password"/>
	<result property="userEmail" column="user_email"/>
	<result property="userInfo" column="user_info"/>
	<result property="headImg" column="head_img" jdbcType="BLOB"/>
	<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
	<!-- <collection property="sysRoleList" columnPrefix="role_" javaType="com.moon.mybatis.pojo.SysRole"> -->
	<collection property="sysRoleList" columnPrefix="role_" ofType="com.moon.mybatis.pojo.SysRole">
		<id property="id" column="id" />
		<result property="roleName" column="role_name" />
		<result property="enabled" column="enabled" />
		<result property="createBy" column="create_by" />
		<result property="createTime" column="create_time" jdbcType="TIMESTAMP" />
	</collection>
</resultMap>

`

  我还发现了书中的好多错误,以后有空就多来写一写书中的错误地方。感恩刘老师无私的传道、授业、解惑。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions