Problem with nested datasource

I have two linked entities with one-to-many composition. But on some master entity instances I see no linked records of nested datasource on my edit form despite these records exist in database table. I can see the records using independent datasource with corresponding JPQL query. I even created a second autogenerated edit form to check the problem existence.
Comparison of master entity instances (with visible and invisible dependent records) gives no results, there is no differencies at all. Depended invisible records are not marked as deleted and are also the same as visible ones and have right ids of master entity instance.
How can it happens? What’s the reasons can lead to such strange behaviour?
Unfortunately I cannot send you my project because of its’ large size and copyright.

I re-created the composition attribute of master entity and the problem disappeared. But I still don’t know the root cause of it.

Did you create composition items manually?
If yes, it isnt enough to set Ordelines.order with Order.id, you need also to add the item to Order.Ordelines (due indexes).

Recreating composition attribute, as you said, you actually recreated indexes too.

When you edit composition in nested datasources, you use a specific view that loads the master instance together with the collection. Depending on the complexity of the view, there were various issues in ORM. We have fixed a lot of them in the latest platform versions. To find out the reason in your case, try to set DEBUG level for eclipselink.sql logger and look at what SQL is generated when you load the entities. Also, setting Fetch mode to BATCH or UNDEFINED for the collection in the view may help.