Cannot get unfetched attribute ... but attribute is included in view ?

Hi, I am getting an unfetched attribute error, but as far as I understand the attribute is included in the view.
I have no idea what’s going wrong.

The error happens when accessing the “ConcertUnit” attribute of “Concert” entity, from the ConcertPerson edit screen.

Steps to reproduce:

  • From TOJM menu, open Concerts
  • Select sample concert and click “Manage Persons” button. (Performers tab opens)
  • In Performers tab, click add
  • In the dialog window, select a person from the lookupField under “Person”.

Here is the error:
IllegalStateException: Cannot get unfetched attribute [concertUnit] from detached object [detached].

However, the view used (“concertPersonWithC_CU-view”) contains both “Concert” and “ConcertUnit”…
What am I missing?

Attached please find the project. Thanks for any help!

java.lang.IllegalStateException: Cannot get unfetched attribute [concertUnit] from detached object [detached].
	at org.eclipse.persistence.internal.queries.EntityFetchGroup.onUnfetchedAttribute(
	at com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup.onUnfetchedAttribute(
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.processUnfetchedAttribute(
	at com.haulmont.chile.core.model.impl.AbstractInstance._persistence_checkFetched(
	at com.haulmont.cuba.web.gui.components.WebLookupField.lambda$attachListener$4850968e$1(
	at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at com.vaadin.event.ListenerMethod.receiveEvent(
	at com.vaadin.event.EventRouter.fireEvent(
	at com.vaadin.event.EventRouter.fireEvent(
	at com.vaadin.server.AbstractClientConnector.fireEvent(
	at com.vaadin.ui.AbstractField.fireValueChange(
	at com.vaadin.ui.AbstractField.setValue(
	at com.vaadin.ui.AbstractSelect.setValue(
	at com.vaadin.ui.AbstractField.setValue(
	at com.vaadin.ui.ComboBox.changeVariables(
	at com.haulmont.cuba.web.toolkit.ui.CubaComboBox.changeVariables( (2.5M)

1 Like

Hi Matthis,

Thank you for your sample project. We have looked at it.

The “tojm$ConcertWithCp.edit” screen is opened with the view which does not contain a link to “ConcertUnit”.
To solve the problem add the “concertUnit” attribute to the “concertWithCP” view.

Let me explain the reason:

In your project, “Concert” is a composition of “ConcertPersons”. Composition entities should be persisted together, and the platform does not reload “Detail” entity when its editor is opened from “Master” editor.

“ConcertUnit” edit-screen is opened from the “Concert” edit-screen.

So “ConcertPersons” edit-screen receives all data from the parent screen (where the “concertUnit” attribute is unfetched).


Hi Rotislav,

Thank you very much for taking the time to look at the uploaded project.

Understood that the platform does not reload “Detail” entity when editor is opened from “Master” editor - now that it makes sense it is easy to fix! Solved.

Thanks again for your clear explanation.
Best regards,