Hello folks
I have a problem with an Object which i can not set as item in an Grid.
If i use just an List with Objectives like that it works (not via JPA)
dummy ObjectiveList (not generated
//ObjectiveList oModel = new ObjectiveList();
//oModel.createObj("Hausarzt besuchen", "blabla", 3);
//oModel.createObj("Einkaufen gehen", "hihihi", 5);
But if i readout object via JPA as objectiveList.getObjectives i can’t display it. But the sysout below is working fine.
View
private Grid<Objective> grid = new Grid<>();
/**
* Constructor creates a new grid for viewing the object list as a table and adds some formatting.
*/
public PatientObjectiveListViewImpl() {
...
...
...
grid.setSelectionMode(SelectionMode.SINGLE);
hLayout2.addComponent(grid);
grid.addColumn(Objective::getName).setCaption("Ziel");
grid.addColumn(Objective::isComplete).setCaption("Status");
this.setContent(vLayout);
}
@Override
public void fillObjectiveList(ObjectiveList objectiveList) {
grid.setItems(objectiveList.getObjectives());
System.out.println(objectiveList.getObjectives().get(0).getName());
}
Objective Model
@Entity
public class Objective {
@Id
@GeneratedValue
private int oid;
private String name;
private String description;
private int difficulty;
private boolean isComplete;
@ManyToOne
private ObjectiveList objList;
Its just showed nothing (look at the attachement)
Where is the problem? Why i cant access on jpa objects? or is it an other fail?
If you need more code, just mention it.
Thanks, kind regards,
Mike