3.3
The generated SQL (show_sql=true):
delete from WorkExecution where plan_id=? and
(id is null) and state=?
this sql is generated for the following query:
Code:
Query query = em.createQuery( "DELETE FROM " + WorkExecution.class.getSimpleName() + " e WHERE e.entriesPlan.id = :id AND e.invoiceWorkDetail=null AND e.state = :temp " );
where
e.invoiceWorkDetail is as follows:
WorkExecution.java
Code:
@OneToOne(mappedBy = "workExecution", fetch = FetchType.EAGER, cascade = {
CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH
})
public InvoiceWorkDetail getInvoiceWorkDetail() {
return invoiceWorkDetail;
}
So as you see, the relationship I'm trying to write in the where clause is to say: the workExecution doesn't have any child in the table InvoiceWorkDetail. (As I'd do in java)
Unfortunately it is translated to a non sens
(id is null)
Anyone has an idea? any suggestion is very welcome
Regards,
Zied