Package server.hibernate

Examples of server.hibernate.User


        int size = resultList.size();
        Object[][] array = new Object[size][numberOfItems];
       
        int i = 0;
        for(Object o: resultList){
            User user = (User)o;
            array[i][0] = user.getUserId();
            array[i][1] = user.getFirstName();
            array[i][2] = user.getLastName();
            ++i;
        }
        return array;
    }
View Full Code Here


   
    public static void displayUsers(List resultList){
        for(Object o: resultList){
                //Actor actor = (Actor)o;
                //System.out.println(actor.getFirstName() + " " + actor.getLastName());
                User user = (User)o;
                System.out.println(user.getLastName() + " " + user.getFirstName());
            }
    }
View Full Code Here

    public static void updateUser(){
        Session session = null;
        try {
            session = HibernateUtil.getSessionFactory().openSession();
            session.beginTransaction();           
            User user = (User)session.get(User.class, new Integer(5))//get item according id                                 
            user.setLastName("Změněný");
            session.update(user);
            session.getTransaction().commit();
        } catch (HibernateException he) {
            session.getTransaction().rollback(); //roll back
            he.printStackTrace();
View Full Code Here

   
    public static void getAllUsers(){       
        String hql = "from User";
        List resultList = Test.executeHQLQuery(hql);
        for(Object o: resultList) {
            User user = (User)o;
            System.out.println(user.getFirstName() + " " + user.getLastName() + " " + user.getPassword());
        }               
    }
View Full Code Here

TOP

Related Classes of server.hibernate.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.