mybatis collection中项的顺序是order by的顺序吗?

假设有如下表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"]吗?

阅读 7.9k
1 个回答

列表(List)与结果集的顺序一致。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题