Repository fetch-plan

Hi,

What fetch plan does jmix repository use by default? Is it _base?
If yes, is there a way for me to specify a custom fetch-plan on a default method, like save()?

In the following example, productMapper.toDto() tries to access unfetched attributes of Product entity.

Product product = productRequestMapper.create(request);
Product savedProduct = productRepository.save(product);
return productMapper.toDto(savedProduct);

productRepository.save() returns the Object with some fields not fetched.
If there is no way to pass fetchplan to save() method, how can I load other properties of a partially loaded entity?

Hello,

Inside the JmixDataRepository is a DataManager that calls the save() method. The saved entity will have a fetchPlan which is based on the loaded fields until the time of saving.

To manually manage loaded fields after saving, you can use dataManager with SaveContext:

dataManager.save(new SaveContext().saving(product, FetchPlan.LOCAL));

Regards,
Nikita