Hi Mario.
Thanks for the very useful import add-on. This is a good job.
But I had a problem. Please help solve it.
When I import new objects with Association Attribute, there are no problems and all references to related objects are formed correctly. But I had a problem updating previously loaded records that have links to other objects.
I performed a debug and I think that the problem occurs when updating an existing object. In this case, the loadAllByAttributes method from SimpleDataLoaderBean.groove is called, but the view is not specified. In this case, the dataManager loads the object from the database using local view, which does not have information about related objects.
And I get the unfetched attribute error:
15:09:36.409 ERROR d.d.c.d.s.GenericDataImporterServiceBean- Error while importing the data: Cannot get unfetched attribute [category] from detached object com.company.base.entity.Model-0dd78fa0-0034-3a85-84bb-7fa189e125ee [detached].
java.lang.IllegalStateException: Cannot get unfetched attribute [category] from detached object com.company.base.entity.Model-0dd78fa0-0034-3a85-84bb-7fa189e125ee [detached].
at org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(EntityFetchGroup.java:100) ~[org.eclipse.persistence.core-2.7.3-6-cuba.jar:na]
at com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup.onUnfetchedAttribute(CubaEntityFetchGroup.java:74) ~[cuba-global-7.1.2.jar:7.1.2]…
I am trying to load objects into the Models table and [category] is a link in the Model table.
Please tell me how to solve this problem. Could it be programmatically defining custom view in the import wizard? Or maybe there are other ways to update already loaded objects with related objects?