Skip to content

Trying to pass a Set of Map.Entry values into foreach. #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Trying to pass a Set of Map.Entry values into foreach. #208

wants to merge 1 commit into from

Conversation

vf42
Copy link

@vf42 vf42 commented May 19, 2014

Submitting the test as requested in #207

Trying to pass a Set of Map.Entry values into foreach.
@vf42 vf42 changed the title Test for https://github.com/mybatis/mybatis-3/issues/207 Trying to pass a Set of Map.Entry values into foreach. May 19, 2014
@emacarron
Copy link
Member

Thanks for the test!!

Seems that this was "broken" in issue https://code.google.com/p/mybatis/issues/detail?can=2&q=709

That issue added support for this specific case so now the .value is simply not needed. Seems you found the way to make it work with 3.0.6.

What is happening now, is that mybatis is not getting the Map.Entry but the value itself, that is an string. When accessing String#value() it happens that this method exists!! and returns a char[] and there is not a type handler for it.

I am afraid this is not a bug, though we did not notice we could have broken existing code. Sorry for that. I will keep this open because maybe @mnesarco or @harawata, that know more than me about the foreach node can have a different opinion.

@vf42
Copy link
Author

vf42 commented May 21, 2014

Got it, thanks for clarification! Not too big change for our code, luckily we have this in just one select mapping.

@harawata
Copy link
Member

Sorry for the late response.
I have reached the same conclusion as @emacarron and verified that @vf42 's solution worked until 3.1.1 and stopped working in 3.2.0.

The only thing that bothers me is the difference between #{param.value} and #{param.key}.
I still haven't had the time to investigate it, but it's not directly related to this issue anyway.

@harawata
Copy link
Member

Oh, sorry. @emacarron already explained about the value(). It's all clear!

@emacarron
Copy link
Member

Thanks for you review Iwao. I will close the PR then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants