Skip to content

Conversation

@FrantaM
Copy link
Contributor

@FrantaM FrantaM commented May 14, 2013

It's similar to Issue 392.
If you have resultMap like:

<resultMap id="postLiteMap2NestedWithSelect" type="domain.blog.BlogLite"> <id column="blog_id" property="id" /> <collection property="posts" ofType="domain.blog.PostLite"> <constructor> <arg javaType="domain.blog.PostLiteId" column="{id=id}" select="selectPostLiteId" /> <arg javaType="_int" column="blog_id"/> </constructor> </collection> </resultMap>

then the arg with select is ignored and posts are unique based on blog_id (which, in this case, is the same). Hence all posts but one are ignored.

@emacarron
Copy link
Member

Hi Franta. I have not looked into the code but I imagine that the problem is that "id=id" probably is being taken as a column name. Not sure but for the time being this may work:

 <arg javaType="domain.blog.PostLiteId" column="id" select="selectPostLiteId" />

If it does work, then the bug turns into "composite columns are not correctly handled to create the row key" :)

@FrantaM
Copy link
Contributor Author

FrantaM commented Jun 3, 2013

No it makes no difference.
I think the problem is in DefaultResultSetHandler#createRowKeyForMappedProperties. It iterates result mappings but considers only those with result map or without nested query.

@emacarron emacarron merged commit 7375e5a into mybatis:master Jun 13, 2013
emacarron added a commit that referenced this pull request Jun 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants