1
我試過並閱讀了有關此問題的其他問題,但我無法將邏輯應用於我的案例。 我試圖從該表中選擇:HQL錯誤 - 預計加入的路徑
@Entity
public class LabelStatistics {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int ID;
@Enumerated(EnumType.STRING)
private AnalysisType type;
private String labelId;
private String hexLabelId;
private Timestamp timestamp;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<LabelStatisticsItem> results;
我試圖執行以下語句:
@Query(value = "SELECT s1.labelId, s1.type, s1.timestamp "
+ "FROM LabelStatistics s1 "
+ "INNER JOIN LabelStatistics s2 on s1.labelId = s2.labelId and s1.type = s2.type and s1.timestamp < s2.timestamp")
List<Object[]> findLatestStatisticsEntries();
我不斷收到此錯誤:
org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join!
有人能解釋的請問如何解決這個問題? 此致敬禮