ibatisの$と#の違いとibatisレポートの無効なシーケンスの解決策

7259 ワード

 sql     in(#rewr#)  in ($rewr$) 
 Ibatis     SqlMap  Sql         ,           # $      ,#       ,      , $         ,  : 

select * from table where id = #id# ,      id    ,  #id#     'id'  ,  id   ,  #id#  id  。 

select * from table where id = $id$ ,    id   ,Sql       ,      id    ,  Sql       select * from table where id = '$id$'


$             , 
select * from $tableName$ 
 
StringBuffer sb = new StringBuffer(256); 
sb.append("select * from ").append(tableName); 
sb.toString(); 

#  
select * from table where id = #id# 
 
prepareStement = stmt.createPrepareStement("select * from table where id = ?") 
prepareStement.setString(1,'abc'); 

------------------------------------------------ 

, , $, # 

, #, sql , ,# prepareStement,  

$ , , $, , ,$  
 
select * from $tableName$  
update $tableName$ set status = #status# ,  
, $ , sql 。
-------------------------------------------------   Ibatis          ----------------------------------------------------------------------
 ibatis       ,  sql     pl/sql      ,      #  $
 :select * from user where grade = #grade# order by #id# desc
    id      
 id   #   $  ,
select * from user where grade = #grade# order by $id$ desc