Skip to content
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

Allow any variable name on ognl expression when specify single value object as parameter object #1487

Merged

Conversation

@kazuki43zoo
Copy link
Member

commented Mar 2, 2019

Fixes gh-1486

I've allowed to access a parameter object(value object) using any variable name on OGNL expression such as same with bind variable name.

In this change, it allow specify as follow:

public interface DemoMapper {
  List<String> selectNameByCategory(Integer category);
}
<mapper namespace="...">
  <select id="selectNameByCategory" resultType="string">
    SELECT name FROM products
    <if test="category != null">
      WHERE id = #{category}
    </if>
  </select>
</mapper>

NOTE:
In version 3.5.0, #{category}(in bind variable) is valid but category != null(in OGNL expression) is invalid.

@M-make

This comment has been minimized.

Copy link

commented Mar 5, 2019

ok thank you

@harawata
Copy link
Member

left a comment

Interesting approach!
I couldn't find any downside, so it probably is OK. :)

Polishing

@kazuki43zoo kazuki43zoo merged commit 08bcdb8 into mybatis:master Jun 14, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kazuki43zoo kazuki43zoo deleted the kazuki43zoo:gh-1486_allow-any-variable-name-on-ognl branch Jun 14, 2019

@kazuki43zoo kazuki43zoo self-assigned this Jun 14, 2019

@kazuki43zoo kazuki43zoo added this to the 3.5.2 milestone Jun 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.