MyBatis 3.1.1 allows either #{...} for prepared statements params, or ${...} for every-time replacement.
I am missing something what would allow to parametrize parts of the SQL statement but still keep it prepared statement; i.e. replace during configuration.
How can I do that? Maybe using some SQL fragments?
Update:
I found:
<sql id="userColumns"> id,username,password </sql>
<select id="selectUsers" parameterType="int" resultType="hashmap">
SELECT <include refid="userColumns"/> some_table WHERE id = #{id}
</select>
See http://www.mybatis.org/core/sqlmap-xml.html#sql
This would be it if ${...}
could be used inside of it.