A에는 두 개의 엔티티가 있습니다. 예를 들어 타이밍 설정 및 주문.HQL에서 날짜 필드를 빼거나 합칠 수 있습니까?
@Entity
public class TimingSettings{
@Basic
private Long orderTimeout = 18000; //for example 18000 sec
....
}
@Entity
public class Order{
@Basic
@OneToOne
private TimingSettings timingSettings;
@Temporal(value = TemporalType.TIMESTAMP)
@Column(nullable = false)
protected Date time;
....
}
어떤 주문에 어떤 타이밍 설정이 있는지 알지 못하기 때문에 시간 초과를 선택하고 필요한 주문 시간을 계산할 수 없습니다.
산사 나무의 열매가 나는 다음과 같은 같은 HQL을 수행 할 수 있습니다
select o from order o
left join o.timingSettings ts
where o.time < current_timestamp()+ ts.orderTimeout