In my continuing expansion of a project I am working on – I now have need to show data in a tree table (because the data is, indeed, hierarchical) …
My main Entity – which I fetched via a JPAContainer (Hibernate flavor) – has an accessor to a set of Entities called Charges … (and one called Cases) …
Charges can be children of other Charges, and there is a nice property for that relationship … all good so far…
My question is this: given the fact I already have the set of Charges (via an accessor off the main Entity) available … how can I EASILY get this showing in a tree table?
Creating a new HierarchicalContainer from scratch and loading it “manually” seems tedious – as does creating a new “HierarchicalBeanItemContainer” … especially since JPAContainer / EntityHierarchicalContainer basically does what I want…
I guess what I would like to do is something simple like:
Set<Charges> setOfCharges ; // this is filled ...
JPAContainer <Charges> chargesContainer = new JPAContainer(Charges.class) ;
chargesContainer.setDataSource( setOfCharges );
chargesContainer.setParentProperty( "parentChargeID");
ANd then bind that to a TreeTable
However, one can’t pre-fill in a JPAContainer as the above (that I can see) –
So what’s the best way to accomplish this?
TIA!
/Steve