}
@Transactional
@Test
public void testPersist() {
UserAccount newUser = new UserAccount();
newUser.setFirstName("John");
newUser.setLastName("Doe");
newUser.setBirthDate(new Date());
newUser.setNickname("Bubba");
newUser.setUserName("jdoe");
repo.persist(newUser);
em.flush();
List results = em.createNativeQuery("select id, user_name, first_name from user_account where user_name = ?")
.setParameter(1, newUser.getUserName()).getResultList();
Assert.assertEquals("should have found the entry", 1, results.size());
Assert.assertEquals("should have found the correct entry", "John", ((Object[])results.get(0))[2]);
UserAccount persistedUser = repo.findByName(newUser.getUserName());
Assert.assertEquals("should have the correct value", newUser.getFirstName(), persistedUser.getFirstName());
Assert.assertEquals("should have the correct value", newUser.getLastName(), persistedUser.getLastName());
Assert.assertEquals("should have the correct value", newUser.getNickname(), persistedUser.getNickname());
Assert.assertEquals("should have the correct value", newUser.getUserName(), persistedUser.getUserName());
Assert.assertEquals("should have the correct value", newUser.getBirthDate(), persistedUser.getBirthDate());
}