UserDaoImpl extends HibernateDaoSupport implements UserDao { @Override @Transactional(propagation = Propagation.REQUIRED) public void deleteUserById(Integer id) { Session session = sessionFactory.getCurrentSession(); String sql = "delete from User where id=:id"; Query query = session.createQuery(sql); query.setParameter("id", id); query.executeUpdate(); }  @Override @Transactional(propagation = Propagation.REQUIRED) List<User> findAllUser(); @Override @Transactional(propagation = Propagation.REQUIRED) int saveEntity(User user); @Override @Transactional(propagation = Propagation.REQUIRED) void saveOrUpdateEntity(User user); @Override @Transactional(propagation = Propagation.REQUIRED) void updateEntity(User user); @Override @Transactional(propagation = Propagation.REQUIRED) User getByName(String name); @Override @Transactional(propagation = Propagation.REQUIRED) User getByNo(String no); @Override @Transactional(propagation = Propagation.REQUIRED) void deleteUserById(Integer id); @Override @Transactional(propagation = Propagation.REQUIRED) void deleteUserByNo(String no); @Override @Transactional(propagation = Propagation.REQUIRED) void deleteUserByEntity(User user);  }
@Test public void deleteUserById() throws Exception { userDao.deleteUserById(10); }