I had create the issue (https://hibernate.atlassian.net/browse/HHH-8868) but was redirected to there.
There some entities and HQL query:
Quote:
@Entity
public class Visit implements Serializable
Unknown macro: { @Id private Integer id; @JoinColumn(name = "ID_SLUCH_MED", referencedColumnName = "ID", nullable = false) @ManyToOne(optional = false, fetch = FetchType.LAZY) private Sluch idSluchMed; @Temporal(TemporalType.TIMESTAMP) private Date visitDate; }
@Entity
public class Sluch implements Serializable
Unknown macro: { @Id private Integer id; @JoinColumn(name = "ID_INSURED", referencedColumnName = "ID", nullable = false) @ManyToOne(optional = false, fetch = FetchType.LAZY) private Insured idInsured; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idSluchMed", fetch = FetchType.LAZY) private List<Visit> visitList; }
@Entity
public class Insured implements Serializable
Unknown macro: { @Id private Integer id; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idInsured", fetch = FetchType.LAZY) private List<Sluch> sluchList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "idInsured", fetch = FetchType.LAZY) private List<HistInvalid> histInvalidList; }
@Entity
public class HistInvalid implements Serializable
Unknown macro: { @Id private Integer id; @Column(name = "BEGDATE") @Temporal(TemporalType.TIMESTAMP) private Date begdate; @Column(name = "ENDDATE") @Temporal(TemporalType.TIMESTAMP) private Date enddate; @JoinColumn(name = "ID_INSURED", referencedColumnName = "ID", nullable = false) @ManyToOne(optional = false, fetch = FetchType.LAZY) private Insured idInsured; }
SELECT v
FROM Visit v
LEFT JOIN v.idSluchMed s
LEFT JOIN s.idInsured i
LEFT JOIN i.histInvalidList h
ON h.begdate < v.visitDate
And I have the following exception:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: with-clause referenced two different from-clause elements
Please, tell me about how I can write this query.