public int updateCpnstWS(String serviceNo, String ifTemp, String ifLast,
String bizFlag) {
System.out.println("Call Mathod : updateCpnstWS");
Session session = HibernateSessionFactory.getSession();
Transaction trans = session.beginTransaction();
try {
TcpnsthistoryDAO tdao = new TcpnsthistoryDAO();
Tcpnsthistory th = tdao.findById(Long.parseLong(serviceNo));
// if(th==null){
// th = new Tcpnsthistory();
// }
th.setIfTemp(Long.parseLong(ifTemp));
th.setIfLast(Long.parseLong(ifLast));
th.setBizFlag(Long.parseLong(bizFlag));
tdao.merge(th);
trans.commit();
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
trans.rollback();
return -1;
}
return 1;
这里注释部分有意义吗,因为serviceNo是主键,
原sql文是 "update tcpnsthistory set If_temp=" + CStr(If_Temp) + " , if_last=" + CStr(If_Last) + _
       " , BIZ_Flag=" + CStr(BIZ_Flag) + " where service_no=" + CStr(service_no)