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

@kazuki43zoo kazuki43zoo commented Mar 2, 2019

Fixes gh-1486 (Related with #1237)

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.

@jzdayz
Copy link

jzdayz commented Mar 5, 2019

ok thank you

Copy link
Member

@harawata harawata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kazuki43zoo kazuki43zoo merged commit 08bcdb8 into mybatis:master Jun 14, 2019
@kazuki43zoo kazuki43zoo deleted the gh-1486_allow-any-variable-name-on-ognl branch June 14, 2019 12:40
@kazuki43zoo kazuki43zoo self-assigned this Jun 14, 2019
@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Jun 14, 2019
@kazuki43zoo kazuki43zoo added this to the 3.5.2 milestone Jun 14, 2019
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
…riable-name-on-ognl

Allow any variable name on ognl expression when specify single value object as parameter object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve a feature or add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why is this happening wrong?
3 participants