java - Difference between ${"id"} and #{"id"} for getting the object reference? -
what difference between these 2 selectors: $("id") , #('id') getting object reference in mybatis mapper xml. have seen examples like
<select id="selectusers" resulttype="map"> select id, username, hashedpassword some_table id = #{id} </select>
as this
<select id="selectuser" parametertype="user" resulttype="user"> select id, username, hashedpassword some_table id = ${user.id} </select>
#{id} - mybatis generate preparedstatement
${id} - mybatis directly inject value in statement string
see string_substitution in mybatis documentation.
Comments
Post a Comment