Cyr*_* N. 5 ebean playframework-2.0
使用Play Framework,我有一个这样的模型:
class MyModel extends Model {
// Some columns
@ManyToOne
public OtherModel other;
public OtherModel getOther() {
return other;
}
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因我无法理解,如果我调用myModel.otherOR myModel.getOther()(myModel作为实例MyModel),我得到一个Null值,即使它应该返回OtherModel的实例!
而且,如果我将getOther()方法更改为:
public OtherModel getOther() {
console.log (String.valueOf(other));
return other;
}
Run Code Online (Sandbox Code Playgroud)
getOther() 返回预期的实例 OtherModel
我只想说......是...... WTF?
有人可以向我解释为什么,以及如何解决这种奇怪的行为?
谢谢 :)
我有类似的问题(但我不需要console.log声明).
我所做的只是用私人场所替换公共场地,并使用公共吸气者和制定者.我认为这是一个Playframework错误,但我找不到我看到的地方.