Package es.udc.tfg.journals.model.user

Examples of es.udc.tfg.journals.model.user.UserDao


  public static void main(String[] args) {

    UserDaoHibernate userProfileDaoHibernate = new UserDaoHibernate();
    userProfileDaoHibernate.setSessionFactory(HibernateUtil
        .getSessionFactory());
    UserDao userProfileDao = userProfileDaoHibernate;

    Transaction tx = HibernateUtil.getSessionFactory().getCurrentSession()
        .beginTransaction();
    try {

      // Register user.
      User userProfile = new User("user@udc.es",
          PasswordEncrypter.crypt("userPassword"), "name",
          "lastName", "user");
      userProfileDao.save(userProfile);
      Long userId = userProfile.getUserId();
      System.out.println("User with userId '" + userId
          + "' has been created");
      System.out.println(userProfile);

      // Find user.
      userProfile = userProfileDao.find(userId);
      System.out.println("User with userId '" + userId
          + "' has been retrieved");
      System.out.println(userProfile);

      // ... proceed in the same way for other entities / methods / use
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.user.UserDao

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.