使用播放框架,我有这样一个模型:
class MyModel extends Model {
// Some columns
@ManyToOne
public OtherModel other;
public OtherModel getOther() {
return other;
}
}
对于原因,我无法理解,如果我叫myModel.other
OR myModel.getOther()
myModel
是的一个实例MyModel
),我得到了一个空值,即使它应该返回OtherModel的一个实例!
此外,如果我改变getOther()
方法,以这样的:
public OtherModel getOther() {
console.log (String.valueOf(other));
return other;
}
getOther()
返回的预期实例OtherModel
我只想说..是...跆拳道?
谁能给我解释一下为什么,以及如何解决这一奇怪的行为?
谢谢 :)