I have defined this query string in filename.hbm.xml
<sql-query name="findByMember">
<return alias="member" class="com.module.vo.MemberVo" />
<![CDATA[
select M.member_nbr as {member.member_nbr} , M.name_last as {member.name_last}
from member M
LEFT OUTER JOIN address A
ON CONCAT('D M ', M.member_nbr) = A.addrtype_who
WHERE M.name_first LIKE :name_first AND M.name_last LIKE :name_last
ORDER BY M.name_last, M.name_first
]]>
</sql-query>
When the query print in the console, I have 3 empty spaces between D and M "CONCAT('D M ', M.member_nbr)" when I do the concatanation but it trim the space to only one space. My query doesn't return the correct data due to the trim of the empty space.
|