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