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
}

Do you have an
@Indexedproperty on your username attribute.Could you please show your
Userclass?The user's fields are null in debug b/c in this mapping mode they are handled transparently by AspectJ, if you call
user.getUserName()in the debugger this should yield the value.Also the variable names in your asserts don't match those from your query-results .e.g
usrFromDb2vs.usr2