【发布时间】:2009-10-16 10:00:13
【问题描述】:
A 有两个实体。例如时间设置和订单。
@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
【问题讨论】: