mybatis-3
mybatis-3 copied to clipboard
Tag assocation and attribute extends in duplicate records
It is utterly confusing to me that using tag assocation and attribute extends .
Here is the sql and the result.Basically i just want to select one permission with many roles.
Then,I using java class to resolve them.
4 records as expected.
So I created a dto to handle the duplicate records with 2 different solutions like this:
Solution one -- using assocation
mapper.xml
java bean
reulst:
Still return 4 records.
Solution two -- using extends attributes
mapper.xml
java bean
result:
Return 2 records with List<Role> as expected
After using extends attribute, it working fine so far.
I was wandering can assocation do this like that?