I'm having trouble getting a field which is in an object which is inside another object. I can get some fields, but others no.
This is the test I created to reproduce this error.
public void commentTest(){
try {
new MyUser("mauri@mail.com","Maurizio Pozzobon","01","facebook","hash").insert();
} catch (Exception e) {}
MyUser user = MyUser.findByEmail("mauri@mail.com");
Place place = new Place(user,"posto","bel posto",null,null);
place.insert();
assertNotNull(user);
Event e =new Event(user,place, "Festa","Questa รจ una gran bella festa",null,new Date(),(long) 10,false,null);
e.insert();
assertNotNull(user.nome);
EventComment ec = new EventComment(user, e, "TestComment", new Date());
ec.insert();
List<EventComment> ecs = e.comments.fetch();
for (EventComment comment : ecs) {
assertNotNull(comment.user.id);
MyUser us= MyUser.findById(comment.user.id);
assertNotNull(us.nome);
assertNotNull(comment.user.nome);
}
}
It fails at the line
assertNotNull(comment.user.nome);
This isn't a deal breaker since I still can get to that field doing other calls to the DB, but it seems weird I can access some fields and others can't
In MyUser I tried both declaring the 'nome' field with and without the following annotations
@Column("nome")
@Max(200) @NotNull
public String nome;