Open pop1213 opened 2 months ago
Hello @pop1213 ,
That is the expected behavior because, in the <collection />
, there is no <id>
element and the values of col1
and col2
are the same.
If the value of col3
is unique for each row of tb_other
, you can use it as ID.
<collection property="others" ofType="com.cyb.admin.domain.TbOther">
<id column="col3" />
<result column="col1" property="col1" />
<result column="col2" property="col2" />
</collection>
I understand what you mean. However, in the above scenario, the console log printing shows that there are two pieces of data, but I get no result at all. This may be puzzling.
MyBatis version
3.5.15
Database vendor and version
mysql8
Test case or example project
Steps to reproduce
create table and import data
mapper.xml
entity Class
execute sql , result like this
test code
Expected result
Actual result