jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
696 stars 125 forks source link

Improve error reporting when cross-datastore reference cannot be loaded #1208

Open knstvk opened 2 years ago

knstvk commented 2 years ago

Now it throws io.jmix.core.EntityAccessException: Unable to load entity access denied or deleted.

See forum topic for more detail.

warhammster commented 1 year ago

@knstvk hi!

This looks like an incorrect behavior of MetaModelLoader. It sets UNDEFINED data store for cross data store references (as they don't have any JPA annotation except Transient). As a result CrossDataStoreReferenceLoader always loads references by ids collection instead of a query:

https://github.com/jmix-framework/jmix/blob/7d7604125677bdb7fc3ae98415ee0be4a1550e00/jmix-core/core/src/main/java/io/jmix/core/impl/CrossDataStoreReferenceLoader.java#L234

Btw shouldn't it ignore soft deletion like it happens for references from the same data store? Looks inconsistent atm.