mybatis - myBatis 映射中 ofType 和 javaType 有什么区别

标签 mybatis

请有人给我解释一下我必须在 mybatis 的映射 xml 文件中使用 ofType 和 javaType 的情况。 并解释它们之间的区别

最佳答案

javaType是当前映射属性的类型。 ofType是集合中元素的类型,仅在<collection>中使用

The documentation状态:

<collection property="posts" javaType="ArrayList" column="id" ofType="Post" select="selectPostsForBlog"/>

Read as: "A collection of posts in an ArrayList of type Post."

关于mybatis - myBatis 映射中 ofType 和 javaType 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42757679/

相关文章:

java - 使用 Longs 的 MyBatis 动态 SQL

mysql - MyBatis Spring 集成 - POJO 上未设置某些 ResultSet 值

java - 组织.postgresql.util.PSQLException : ERROR: null value in column "id" violates not-null constraint

java - 如何在同一个应用程序中使用Hibernate和MyBatis

java - 在mybatis中插入值列表

mysql - 我想传递相同的ajax属性

java - mybatis 的 foreach 返回 Null 结果

oracle - mybatis批量处理多表插入

MyBatis - 原始类型列表

select - Mybatis 关联/集合的嵌套选择不起作用