Problem updating previously loaded records that have links to other objects

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?2019-12-03_152607 2019-12-03_152643 2019-12-03_152700 2019-12-03_152724

hi,

this is probably a bug in the addon. I think I will have to take a look into that scenario.

In order to help you, you can prepare a test project with a test data import configuration and share it here in the topic.

Cheers
Mario

I think I found the problem. Further information can be found here: Data Import fails with Unique Configuration: Update and association attribute binding · Issue #151 · mariodavid/cuba-component-data-import · GitHub

Hi,

problem should be solved in 0.11.1 - please give it a try and see if the error is gone. Thanks!

Cheers
Mario

1 Like

Hello Mario.
Thanks so much for the update! Now everything is fine. Good job :+1: