我無法獲取位於另一個對象內的對象中的字段。我可以得到一些領域,但其他人沒有。無法從Siena的另一個對象中的對象獲取字符串字段
這是我爲重現此錯誤而創建的測試。
public void commentTest(){
try {
new MyUser("[email protected]","Maurizio Pozzobon","01","facebook","hash").insert();
} catch (Exception e) {}
MyUser user = MyUser.findByEmail("[email protected]");
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);
}
}
它未能在該行
assertNotNull(comment.user.nome);
這不是一個大忌,因爲我仍然可以到現場做其他調用數據庫,但它似乎不可思議,我可以訪問某些領域而別人無法
在MYUSER我嘗試都宣告「諾姆」字段使用和不使用以下注釋
@Column("nome")
@Max(200) @NotNull
public String nome;
非常感謝你總是清理乾淨! – 2011-05-29 13:40:31