Oto moja HQL:Wsporniki w HQL nie ntranslated do SQL
Query query = createQueryOnCurrentSession("DELETE Email e " +
"where " +
"(status = :sent and creationTime <= :creation)" +
"or " +
"(status = :error and maxEttempts >= :maxEttempts)");
Oto generowane SQL:
delete from `email` where `status`=? and `creation_time`<=? or `status`=? and `attempts`>=?
Pytanie: dlaczego są wsporniki nie w SQL? Spodziewam się, że będzie:
delete from `email` where (`status`=? and `creation_time`<=?) or (`status`=? and `attempts`>=?)
może być alternatywą będzie usunąć w 2 wnioski?
delete from `email` where `status`=? and `creation_time`<=?
delete from `email` where `status`=? and `attempts`>=?
spróbować ucieczki nawiasy tak: '\ (' –
pojedynczy '” \ ("' nie kompiluje (oczywiście) i podwójnie '" \\ ("' throw throw: 'org.hibernate.QueryException: nieoczekiwany znak: '\' [DELETE com.grroo.model.Email e gdzie \ (status =: wysłana i creationTime <=: tworzenie \) lub \ (status =: błąd i próby> =: maxAttempts \)] ' – urir
Myślę, że ty można dołączyć ciąg kwerendy jako warunek, a następnie wykonać –