Data loss when modifying entity that references another entity of another DataStore - jmix v2.4.1

I lost data when modifying an entity that references another entity of another DataStore.

I have another DataStore: otherStore, connected via REST DataStore, in otherStore there is an entity “User”.

And I have an entity “Contract” in the Main Data Store, in “Contract” I have a field “user” that links to the table “User” in otherStore and @DependsOnProperties field: “userId”.

Contract List Screen:
image

I have a contract edit screen with fetchPlan="_base".
Contract Edit Screen(fetchPlan="_base"):
image

After I edit the “name” field and save, the “user” and “userId” fields data are lost:
image

Same when I run BPM process when I use: Entity Data Task. I also lost data feild “user” and “userId”:
image

Can you explain and give me any solution or suggestion?
Many thanks & Best regards
HungTM

Hi HungTM

Thank you for reporting the problem!
Created issue: Cross-datastore reference is cleared when using _base fetch plan · Issue #3963 · jmix-framework/jmix

We’ll try to fix it for the next 2.4 patch.

Regards,
Konstantin

1 Like

Thanks for your reply, hope to receive a solution from you soon!

Many thanks & Best regards
HungTM

Hi Krivopustov

Thanks for fixing the above bug in version 2.4.2.

But I have a new problem when creating ContractProvider table and @ManyToOne reference to Contract and when I open edit screen with full fetchPlan I get error like this:

image

Best regards,
HungTM

Could you provide a test project or at least the detailed explanation of all entities and views, and the full stack trace?

Here I have an example project, still from your project and I have upgraded the version and added 2 more entities, to reproduce the error, create a “Contract” record and then create a “ContractProvider” record and you will get the above error.

Project example: jmix-demo-v2

Best regards,
HungTM

Hi HungTM

Thank you again for the bugreport.
Created issue: NPE when loading nested cross-datastore references · Issue #4019 · jmix-framework/jmix

We’ll try to fix it in the next patch.

Regards,
Konstantin

1 Like