A have two entities. For example timing settings and orders.
@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;
....
}
I can't select timeout before and calculate needed order time, because I don't known what orders have what timing settings.
Haw can I perform HQL same as the following:
select o from order o
left join o.timingSettings ts
where o.time < current_timestamp()+ ts.orderTimeout