日期:2014-05-17  浏览次数:20795 次

SQL语句参数化问题
   
  例如:
   String c='500';
   "select  * from  a  where a.b  not in ( " + c + ")";


   把这个C用 ? 代替  该怎么写
sql

------解决方案--------------------
select * from where a.b not in :c
------解决方案--------------------
String c='500';
 String sql = "select  * from  a  where a.b  not in ( ?)";

List<object[]> o = getsession().createsql(sql).setstring(0, c).list();

大致是这样