When I run the code below, a new User with the expected properties is created. (I confirm with Neoclipse after running the test). However, findByPropertyValue
fails to retrieve the user. It just returns null. When I debug I find that usrFromDb1
only seems to contain null-values, even those values that I later confirmed were infact saved in the databse!
Does anyone have an idea for a solution?
@Test(enabled = true, groups = {"functest"})
public void shouldGetUserDetails() throws Exception {
User user = new User("admin", "secretpw").persist();
User usrFromDb1 = userRepository.findOne(user.getId());
assertNotNull(usr1); //succeeds
User usrFromDb2 = userRepository.findByPropertyValue("username", "admin");
assertNotNull(usr2); //fails
}