@Override public UserAct getActById(int logId) { Session session = HibernateUtil.currentSession(); Criteria c = session.createCriteria(UserAct.class); c.add(Restrictions.eq("logId", logId)); return (UserAct) c.uniqueResult(); }
@Override public List<UserAct> queryAll() { // TODO Auto-generated method stub Session session = HibernateUtil.currentSession(); String hql = "from UserAct"; Query query = session.createQuery(hql); return query.list(); }
@Override public void addAct(UserAct ua) { Session session = HibernateUtil.currentSession(); session.save(ua); Transaction tx = session.beginTransaction(); tx.commit(); System.out.println(ua.getLogId() + ua.getUserId()); }