日期:2014-05-17 浏览次数:20708 次
String delStr = "delete from PLM_EDITLOCK where OBJECTID="+caseId+" and USERID='"+userId+"'"; try{ Session session = HibernateUtil.currentSession(); session.connection().createStatement().execute(delStr); }catch(Exception se){ //throw se; System.err.println("delete error!"); }
public static void UpdateSQL(String SqlStr){ try{ session = HibernateUtil.currentSession(); Transaction tx= session.beginTransaction(); Query query = session.createQuery(SqlStr); query.setCacheable(false); query.executeUpdate(); tx.commit(); } catch (HibernateException e) { e.printStackTrace(); } finally{HibernateUtil.closeSession();} }