Hello,
I have an entity called Kontrolle (see code at the bottom) that uses a NamePattern that requires data from multiple object. In order to make this work, I have to create view that contains all required attributes. The minimal view does not work contain all required values.
But when I try to use the “Entity Inspector” or the “Global fts search”, this does not work since it uses a default view (_minimal or _local?).
In this case I get this error message:
QueryException:
Exception Description: The value e.ueberwachungssichtBetriebsstaette.betriebsstaette.betriebsstaette supplied to the query hint eclipselink.left-join-fetch navigated a non-existent relationship. The relationship betriebsstaette.betriebsstaette does not exist.
Query: ReadObjectQuery(referenceClass=Kontrolle sql=“SELECT ID, … FROM BALVILM_KONTROLLE WHERE ((ID = ?) AND (DELETE_TS IS NULL))”)
Do you see a solution for this issue? I have these ideas:
- Add a String property ‘caption’ to Kontrolle and save the caption then the entity is updated. But this creates redundancy and the property has to be updated when Kontrolle or Betriebsstaette changes which is quite cumbersome.
- Override the view that is used in “Entity Inspector” and the “Global fts search”. But I am not sure if this is possible.
- Extend @NamePattern/ minimal view so that it can deal with this situation.
What do you thing?
Thanks in advance.
Yours,
Joerg
Here are the entities
@Table(name = "BALVILM_KONTROLLE")
@Entity(name = "balvilm$Kontrolle")
@NamePattern("#getCaption|ueberwachungssichtBetriebsstaette,kontrolldatum")
public class Kontrolle extends BearbeitungsstandEntity {
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "UEBERWACHUNGSSICHT_BTS_ID")
protected UeberwachungssichtBetriebsstaette ueberwachungssichtBetriebsstaette;
...
public String getCaption() {
String formatiertesKontrolldatum = AppBeans.get(DatatypeFormatter.class).formatDate(kontrolldatum);
return ueberwachungssichtBetriebsstaette.getBetriebsstaette().getBezeichnung() + " (" + formatiertesKontrolldatum + ")" + " (" + this.getClass().getSimpleName() + ")";
}
}
--------
@NamePattern("#getCaption|betriebsstaette,ueberwachungssicht")
@Table(name = "BALVILM_UEBERWACHUNGSSICHT_BTS")
@Entity(name = "balvilm$UeberwachungssichtBetriebsstaette")
public class UeberwachungssichtBetriebsstaette extends StandardEntity {
@OnDelete(DeletePolicy.UNLINK)
@OneToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "BETRIEBSSTAETTE_ID")
protected Betriebsstaette betriebsstaette;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "UEBERWACHUNGSSICHT_ID")
protected Ueberwachungssicht ueberwachungssicht;
...
public String getCaption() {
return betriebsstaette.getBezeichnung() + " (" + ueberwachungssicht.getBezeichnung() + ")";
}
}
--------
@NamePattern("%s|bezeichnung")
@Table(name = "BALVILM_UEBERWACHUNGSSICHT")
@Entity(name = "balvilm$Ueberwachungssicht")
public class Ueberwachungssicht extends StandardEntity {
private static final long serialVersionUID = -39963171871445890L;
@Column(name = "BEZEICHNUNG", nullable = false)
protected String bezeichnung;
}
----
@Table(name = "BALVILM_BETRIEBSSTAETTE")
@Entity(name = "balvilm$Betriebsstaette")
@NamePattern("%s|bezeichnung")
public class Betriebsstaette extends MandantEntity {
private static final long serialVersionUID = 4839563979247487690L;
@Column(name = "BEZEICHNUNG")
protected String bezeichnung;
...
}