I have a simple Vendor entity that contains an Address. The ‘edit’ screen works fine when creating a new entity:
but, if I then click edit on the entity I just created, it fails with:
java.lang.IllegalStateException: Cannot get unfetched attribute [address] from detached object com.company.grocery.entity.Vendor-bca65ca4-440d-ef5c-1ea7-8f6eb8719a8d [detached].
at org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(EntityFetchGroup.java:98)
at com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup.onUnfetchedAttribute(CubaEntityFetchGroup.java:74)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(EntityManagerImpl.java:2846)
at com.haulmont.chile.core.model.impl.AbstractInstance._persistence_checkFetched(AbstractInstance.java)
at com.company.grocery.entity.Vendor._persistence_get_address(Vendor.java)
at com.company.grocery.entity.Vendor.getAddress(Vendor.java:59)
at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.haulmont.chile.core.model.utils.MethodsCache.invokeGetter(MethodsCache.java:72)
at com.haulmont.chile.core.model.impl.AbstractInstance.getValue(AbstractInstance.java:102)
at com.haulmont.cuba.core.entity.BaseGenericIdEntity.getValue(BaseGenericIdEntity.java:139)
at com.haulmont.chile.core.model.utils.InstanceUtils.getValueEx(InstanceUtils.java:148)
at com.haulmont.cuba.web.gui.data.PropertyWrapper.getValue(PropertyWrapper.java:76)
at com.vaadin.ui.AbstractField.readValueFromProperty(AbstractField.java:1364)
at com.vaadin.ui.AbstractField.valueChange(AbstractField.java:1357)
at com.haulmont.cuba.web.gui.data.AbstractPropertyWrapper.fireValueChangeEvent(AbstractPropertyWrapper.java:58)
at com.haulmont.cuba.web.gui.data.PropertyWrapper.lambda$new$0(PropertyWrapper.java:54)
at com.haulmont.cuba.gui.data.impl.WeakItemChangeListener.itemChanged(WeakItemChangeListener.java:40)
at com.haulmont.bali.events.EventRouter.fireEvent(EventRouter.java:45)
at com.haulmont.cuba.gui.data.impl.AbstractDatasource.fireItemChanged(AbstractDatasource.java:283)
at com.haulmont.cuba.gui.data.impl.DatasourceImpl.setItem(DatasourceImpl.java:190)
at com.haulmont.cuba.gui.components.EditorWindowDelegate.setItem(EditorWindowDelegate.java:190)
at com.haulmont.cuba.web.gui.WebWindow$Editor.setItem(WebWindow.java:1683)
at com.haulmont.cuba.gui.components.AbstractEditor.setItem(AbstractEditor.java:71)
at com.haulmont.cuba.gui.WindowManager.openEditor(WindowManager.java:888)
at com.haulmont.cuba.web.WebWindowManager.openEditor(WebWindowManager.java:178)
at com.haulmont.cuba.gui.components.WindowDelegate.openEditor(WindowDelegate.java:258)
at com.haulmont.cuba.web.gui.WebWindow.openEditor(WebWindow.java:487)
at com.haulmont.cuba.gui.components.actions.EditAction.internalOpenEditor(EditAction.java:274)
at com.haulmont.cuba.gui.components.actions.EditAction.actionPerform(EditAction.java:223)
at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:45)
at com.haulmont.cuba.web.gui.components.WebButton.lambda$new$61446b05$1(WebButton.java:37)
at sun.reflect.GeneratedMethodAccessor224.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1037)
at com.vaadin.ui.Button.fireClick(Button.java:377)