2012-09-26 78 views
0

Hibernate不支持TIMESTAMPDIFF爲OracleHibernate併爲Oracle不支持TIMESTAMPDIFF

它是Oracle給了一個錯誤,但運行在MySQL非常精細

**Query** :select app from Application app where app.id not in (select aml.referenceId from AuditMailLog aml where app.id = aml.referenceId and aml.event = 'application_expiry_reminder' and aml.referenceTableName = 'application') and TIMESTAMPDIFF(DAY, created_date, CURRENT_TIMESTAMP()) >= 30 and status in (0,1) 

誰能告訴我什麼可以替代?

回答

0

您可以使用DetachedCriteria進行查詢,使用Restrictions.sqlRestriction進行SQL函數。