Question: How to load an entity with all data and relations in the custom code?
Context:
I have a table with Entities. I’m trying to implement my custom action similar to “Excel”.
Only some basic data is showing in my table, but I have to export all data and relations.
I tried to add children collection data sources but have got “IllegalStateException: Cannot get unfetched attribute [attribute_name] from detached object.”
I am assuming you are using a LoadContext to retrieve data. In a LoadContext, you have the option to specify the view to use. If you don’t specify a view to use, I believe it defaults to the “local” view which excludes any foreign references.
LoadContext<YourEntity> context = LoadContext.create(YourEntity.class)
.setQuery(LoadContext.createQuery(
"select e from deiproductconfig2$YourEntity e ))
.setView("YourEntity-view");