JPAContainer and TreeTable

Hi All,

please is there any example showing how to get TreeTable and JPAContainer working together. I am facing one issue JPAContainer implements Hierarchical interface, but method setParent is unsupported.

Do you have any idea how to implement TreeTable backed by any JPA/SQL Container?

Many thanks.

Hi,

Are you looking for JPAContainer.setParentProperty()?

This works for buiding a hierarchical container of Departments, where Department has a property named parent that points to it’s parent Department:

        JPAContainer<Department> departmentContainer = new JPAContainer<Department>(
                Department.class)
        departmentContainer
                .setEntityProvider(new CachingLocalEntityProvider<Department>(
                        Department.class, em));
        departmentContainer.setParentProperty("parent");

HTH,
/Jonatan