Bean from Item and Object from bean


I thought that this question would have been asked before but I couldn’t find it or another reason is that the solution is so simple, that I am only newbie enough to ask that :slight_smile:

new StaffView(companyTable.getItem(companyTable.getValue())));

How an earth I can get company-object from Item-object in StaffView? Item is an interface so casting is not working and I don’t know what is the id of property etc.
EDIT: With EntityItem it is easy, but I still wanna know is it even possible with Item?

orrr even better would be if somebody could answer how can I get staffs from the company using JPAContainer. I am trying to build a new table for staff-objects and at the moment it is showing every staff-objects I have instead of showing only the company’s staff. I decided to take companyItem and get a company from it and companyID and ask every staff-objects from DB with that ID using JPQL. Sounds silly?

I am asking that in another message:


You cannot do that in general because an Item is not necessarily backed by a bean - a lot of container use Items that do not map directly to a single POJO. EntityItem and BeanItem have specific APIs for this.

However, for the items that do map to a POJO (BeanItem, JPAContainer EntityItem, perhaps others), there have been plans of introducing a common interface for this. I believe there is a ticket for this, although I could not find it immediately.