DataManager.commit does not refresh view on new items

I have following setup:

Customer
 - name
 - age
Order
 - customer -> Customer

View for Order - name: with-customer-age, extends _local
 - customer view=with-age
View for Customer - name: with-age, extends _minimal
 - age

Order browser and editor uses the with-customer-age view and both use the age for some logic (could not think of any example - maybe different color for orders where customer does not meet a minimal age for all products)

Order browser has a lookup field with a datasource listing customers with _minimal view (wo age)

When CreateAction is used and instance is committed, DataManager.commit is called and provided with with-customer-age view, despite that, the returned entity has the customer field still in the _minimal view. First I thought this was by design, but I found out that this works perfectly well with EditAction - again commit is called, but the retrieved entitiy’s customer is returned with the view with-customer-age as it should be, so I consider this a bug.

Why is this a problem?

My actual scenario is much more complex and confidential. We have lots of views and we try to use them effectively (fetching with full view to lookup field seems like a waste). As well, it is sometimes impossible to think what a change in a dependency like this (towards a similar field like age) might cause - I want a view of an editor to be a contract - that this is the view that will be applied to the returned entity and I don’t want to think of all the possible lookup fields that a change in a view might affect.

Thank you,

Hi Jan,

I can confirm that the problem exists. We have overlooked it - fetching by view is incorporated in the EntityManager.merge() method, but not in persist(). So we should either do it for persist() somehow, or move the fetching to the upper level in RdbmsStore.

The issue is now assigned to release 6.6, but after fixing it we’ll consider porting it to 6.5.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-9325