public String deleteByUserAccount(String account) { 方式一:
Session session = this.getCurrentSession(); Criteria criteria = session.createCriteria(SysUserC.class).add(Restrictions.eq("account", account)); Object object = criteria.uniqueResult(); if (object == null) { return null; } else { session.delete((SysUserC)object); return "SUCCESS"; } }
方式二:
Session session = this.getCurrentSession();String sql = "delete from sys_sms_log where mobile='" + account + "'";
session.createSQLQuery(sql).executeUpdate();