Error reading entity-field of a joined table


I am using a lookuptable from invoice to customer via customer-id. So when I have an entity of the invoice-table and try to read a field of the related customer, I am getting the following error:

IllegalStateException: Cannot get unfetched attribute [kunde] from detached object com.pd.abf.entity.AuftragKopf-3004 [detached].

Here is a part of the invoice-entity:

–snip –
@Table(name = “ABF_AUFTRAG_KOPF”)
@Entity(name = “abf$AuftragKopf”)
public class AuftragKopf extends BaseLongIdEntity implements Versioned, Updatable, Creatable, HasUuid {
private static final long serialVersionUID = 4516857111684197168L;

@Column(name = "KOPF_ID", nullable = false, unique = true)
protected Long kopfId;

@Column(name = "RECHNUNGS_DATUM")
protected Date rechnungsDatum;

@Column(name = "BUCHUNGS_NUMMER", nullable = false, unique = true, length = 20)
protected String buchnungsNummer;

@Column(name = "RECHNUNGS_NUMMER", unique = true)
protected Long rechnungsNummer;

@Column(name = "BEMERKUNG", length = 2000)
protected String bemerkung;


** @ManyToOne(fetch = FetchType.LAZY, optional = false)**
** @JoinColumn(name = “KUNDE_ID”)**
** protected Adresse kunde;**

@Column(name = "DATUM", nullable = false)
protected Date datum;

@OneToMany(mappedBy = "aufftragsKopf")
protected List<AuftragsPosition> position;

@Column(name = "VORNAME", length = 80)
protected String vorname;

@Column(name = "NAME1", nullable = false, length = 80)
protected String name1;

@Column(name = "NAME2", length = 80)
protected String name2;

@Column(name = "NAME3", length = 80)
protected String name3;

@Column(name = "STRASSE", length = 80)
protected String strasse;


What is the way, get the lookup-entity fetched (here it is “Adresse”).

Thanks very much.

Hi Martin,

generally the unfetched attribute errors occur due to wrong usage of the view concept. I wrote an article about a while ago. You can find it here:

In order to help you, you need to show us:

  1. the views.xml
  2. the screen controller xml descriptors

this way we can see which views you defined and which you use in the screens.

It would be best, if you could provide an example which has only the problematic parts to reproduce your question / problem.


Hi Mario,

thanks. It was my mistake. The Dataset bound to my list was the base table, not the view I usered for the mask.
I changed it. Now it works.

Thanks very much.