public boolean ChangeReturnStatus(String id,int nn){ Connection conn=HibernateUtil.getSession().connection(); String sql = "update TableName set a='" + nn+ "' where TypeID='"+id+"'"; Statement stmt=null; int i=0; try { stmt=conn.createStatement(); i= stmt.executeUpdate(sql); if(i!=0){ return true; } } catch (Exception e) { e.printStackTrace(); } return false; }