Hello all:
I’m attempting to attach the List from a JPA getResultList() call to a table via a BeanItemContainer. Essentially, the code looks like this:
List<Therapist> resultList = therapistQuery.getResultList();
therapistTable.setSelectable(true);
therapistTable.setMultiSelect(false);
therapistTable.setImmediate(true);
therapistTable.setContainerDataSource(new BeanItemContainer(resultList));
The behaviour I’m seeing is: only one row of the resultList is shown in the table (and I have confirmed that there is more than one item in the resultList), and that the valueChange() method is not triggered when you select the row in the table.
The classes returned by the query (there are 3 tables involved, in a grandparent, parent, child relationship joined by a single foreign key column each) are full of JPA annotations (i.e. @NamedQuery, @Entity, @Column, @ManyToOne, @JoinColumn, etc.) and I’m wondering if that may be causing problems (I’m new to annotations and I can’t say I understand exactly how they work). The reason I suspect that this might be the case, is that If I create plain (POJO) versions of the classes in question and manually build a list of those using the class instances returned by the query, then the table displays and acts correctly.
So, is there something about the BeanItemContainer that would prevent it from working in the way I am using it (and I should be doing something different), or am I just coding it incorrectly or is there not enough information in the above to say?
Thanks, Maury