mercredi 17 juin 2015

Grab attribute elements from the hibernate session

I am using hibernate to grab the user input and put user info to to a list. Here is part of the code:

    public String Authentication(String loginUserName, String clientPassword, HttpSession session, HttpServletResponse httpResponse) throws Exception {
        EntityManager entityManager = PersistenceManager.getEntityManager();
        Session sess = entityManager.unwrap(Session.class);
        Criteria crit = sess.createCriteria(Users.class).add(Restrictions.eq("userName", loginUserName));
        List results = crit.list();
    }

If I understand correctly, the above code stores the user attributes into the list, in this case the list name is results.Assuming one of the attributes name is id, how can I grab the id from the list?

Aucun commentaire:

Enregistrer un commentaire