在对数据库操作不成功的时候需要看下后台拼的SQL,以及参数是怎样,以判断那底是怎么不成功的。在TransactionWithActionRecord的
rivate static List<SQLItem> getSQLItems(HttpServletRequest request,String[] mapping,boolean ignoreNull)方法中加上一句代码(红色):
private static List<SQLItem> getSQLItems(HttpServletRequest request,String[] mapping,boolean ignoreNull){
List<SQLItem> list = new ArrayList<SQLItem>();
if(mapping == null ) return list;
for(int i=0;i<mapping.length;i++){
String item = mapping[i];
String[] spts = item.split("#");
SQLItem sqlItem = null;
String paramValue = (String)request.getAttribute(spts[0]);
if(paramValue == null){
paramValue = request.getParameter(spts[0]);
}
System.out.println(spts[0]+":"+paramValue);
if(ignoreNull){
if(paramValue==null){
continue;
}
}
if(spts.length<3){
sqlItem = new SQLItem(spts[0],spts[1],paramValue);
}else{
sqlItem = new SQLItem(spts[2],spts[1],paramValue);
}
list.add(sqlItem);
}
return list;
}