ibatis 種種

1、<> 需要用<![CDATA[ <> ]]>轉義


2、模糊查詢:

無效的方法:

select  *  from table1 where name like '%#name#%'

 兩種有效的方法: 1) 使用$代替#。此種方法就是去掉了類型檢查,使用字符串連接,不過可能會有sql注入風險。

select  *  from table1 where name like '%$name$%'

 2) 使用連接符。不過不同的數據庫中方式不同。

mysql: 

select  *  from table1 where name like concat('%', #name#, '%')

 oracle:

select  *  from table1 where name like '%' || #name# || '%'

 sql server:

 select  *  from table1 where name like '%' + #name# + '%'

3、ibatis常用語句:http://javacrazyer.iteye.com/blog/1135561

4、ibatis 中isNull, isNotNull與isEmpty, isNotEmpty區別http://blog.csdn.net/fanfanjin/article/details/6676566






發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章