java - mybatis collection中项的顺序是order by的顺序吗?
阿神
阿神 2017-04-18 10:15:43
0
1
852

假设有如下表table:

id | str
---|---
1  | B
1  | A

sql:

select id, str from table order by str;

显然会返回:

id | str
---|---
1  | A
1  | B

考虑如下mybatis mapper:

<resultMap type="someType" id="rm">
    <id property="id" column="id" />
    <collection property="strs" ofType="String">
    </collection>
</resultMap>

属性id为1,属性strs类型为List<String>,它的值一定会是["A","B"]吗?

阿神
阿神

闭关修行中......

reply all(1)
大家讲道理

Lists (List) are in the same order as the result set.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template