Edit specific child in parent entity edit screen (Ex Manager of Company)

Hello,

how can i load and make screen edit for specific child of an entity?

For example, in Company edit screen, i want load the manager (employee) and edit some of his field (using fieldGroup in a tab component).
The company entity contain a @Composition of employees.

i try to use collectionDatasource but data of managerDs is not loaded in the fieldGroup fields is not loaded


<dsContext>
       <datasource id="companyDs"
                        class="com.company.Company"
                        view="test">
       </datasource>
       <collectionDatasource id="managerDs"
                              class="mdipi.gov.dz.pme.entity.Employee"
                              view="employee-screen-view">
            <query>
                <![CDATA[select e from pme$Empoyee e where e.company.id =:ds$companyDs and e.manager = true]]>
            </query>
        </collectionDatasource>
</dsContext> 

is there another way to do that with nested data source or

  • Is there a similar to @Where hibernate annotation in ecliplseLink Or JPA to make transient manager field in Company entity

Regards,
Mounir

Hi Mounir,

Your approach with the collectionDatasource should work if you invoke its setItem() method in the postInit() or ready() method of the controller. When you attach a FieldGroup to a datasource, it displays a “current” item, which is not set automatically when a collection datasource is refreshed - that’s why you don’t see any values in the FieldGroup.