java - Why is Ebean not loading field project from ZenTasks example application? -
i'm following zentask application play-framework tutorial , ended here: http://www.playframework.com/documentation/2.2.x/javaguide3
now think have either found bug or i'm missing in reasoning, anyway, tutorial has following line of code in application.java
:
task.find.all()
the task class has 2 interesting fields:
@manytoone public user assignedto; @manytoone public project project;
now have following test cases:
@test public void successuserloadtest(){ list<task> tasks = task.find.all(); for(task t : tasks){ if(t.assignedto != null) assertnotnull(t.assignedto.name); } } @test public void failingprojectloadtest(){ list<task> tasks = task.find.all(); for(task t : tasks){ if(t.project != null) assertnotnull(t.project.name); } } @test public void successprojectloadtest(){ list<task> tasks = task.find.fetch("project").findlist(); for(task t : tasks){ if(t.project != null) assertnotnull(t.project.name); } }
the problem project field not populated/loaded while assignedto field is. , when explicitly load project field there no problem.
any idea's how can solve or better practice explicitly load manytoone
fields?
greetings!
upgrading play-2.2.2-rc2 seems have solved problem. similar problem described here: play 2.1.3 application maven enhanced models not loading lazy objects
still no explanation why assignedto
field populated, bug in case.
Comments
Post a Comment