Package com.springone.myrestaurants.domain

Examples of com.springone.myrestaurants.domain.UserAccount.persist()


      newUser.setLastName("Doe");
      newUser.setBirthDate(new Date());
      newUser.setNickname("Bubba");
      newUser.setUserName("jdoe");
      em.persist(newUser);
        newUser.persist();
      Assert.assertEquals("Should have zero friends", 0, newUser.getFriends().size());     
      newUser.getFriends().add(user);
      Assert.assertEquals("Should have a list of friends", 1, newUser.getFriends().size());
    }
   
View Full Code Here


      newUser.setBirthDate(new Date());
      newUser.setNickname("Bubba");
      newUser.setUserName("jdoe");
      userAccountRepo.persist(newUser);
      em.flush();
        newUser.persist();
      user.getFriends().add(newUser);
      UserAccount updatedUser = userAccountRepo.findUserAccount(userId);
      Assert.assertNotNull("should have found something" ,updatedUser);
      Assert.assertEquals("user should now have correct number of friends", 1, updatedUser.getFriends().size());
      user.getFriends().remove(newUser);
View Full Code Here

    u.setLastName("Jones");
    u.setBirthDate(new Date());
    u.setUserName("user");
    setUpEm.persist(u);
    setUpEm.flush();
        u.persist();
    this.userId = u.getId();
    setUpTx.commit();
  }

    @Before
View Full Code Here

  @Transactional
  public UserAccount findUserAccount(Long id) {
        if (id == null) return null;
        final UserAccount userAccount = entityManager.find(UserAccount.class, id);
        if (userAccount != null) {
          userAccount.persist();
        }
        return userAccount;
    }
    @Transactional
  public UserAccount findByName(String name) {
View Full Code Here

    java.util.List resultList = q.getResultList();
    if (resultList.size() > 0)
    {
            final UserAccount userAccount = (UserAccount) resultList.get(0);
            if (userAccount != null) {
              userAccount.persist();
            }
            return userAccount;
    }
    return null;
  }
View Full Code Here

  private UserAccount getCurrentUserAccount() {
    String currentUser = SecurityContextHolder.getContext()
        .getAuthentication().getName();
    UserAccount userAccount = userAccountRepository.findByName(currentUser);
    if (userAccount != null) {
      userAccount.persist();
    }
    return userAccount;
  }

  void addDateTimeFormatPatterns(Model model) {
View Full Code Here

    u.setLastName("Jones");
    u.setBirthDate(new Date());
    u.setUserName("user");
    setUpEm.persist(u);
    setUpEm.flush();
        u.persist();
    this.userId = u.getId();
    setUpTx.commit();
  }

    @Before
View Full Code Here

      newUser.setLastName("Doe");
      newUser.setBirthDate(new Date());
      newUser.setNickname("Bubba");
      newUser.setUserName("jdoe");
      em.persist(newUser);
        newUser.persist();
      Assert.assertEquals("Should have zero friends", 0, newUser.getFriends().size());     
      newUser.getFriends().add(user);
      Assert.assertEquals("Should have a list of friends", 1, newUser.getFriends().size());
    }
   
View Full Code Here

      newUser.setBirthDate(new Date());
      newUser.setNickname("Bubba");
      newUser.setUserName("jdoe");
      userAccountRepo.persist(newUser);
      em.flush();
        newUser.persist();
      user.getFriends().add(newUser);
      UserAccount updatedUser = userAccountRepo.findUserAccount(userId);
      Assert.assertNotNull("should have found something" ,updatedUser);
      Assert.assertEquals("user should now have correct number of friends", 1, updatedUser.getFriends().size());
      user.getFriends().remove(newUser);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.