建议统一采用直接以sql语句的方式删除:
Session session = getSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
String hqlDelete = "delete UserContract where usercontractId = :id";
session.createQuery( hqlDelete ).setInteger("id", id ).executeUpdate();
tx.commit();
} catch (RuntimeException re) {
log.error("delete contractType failed", re);
if(tx != null) tx.rollback();
throw re;
}finally{
session.close();
}