例如,我应该能够执行以下操作:
Query deleteQuery = entityManager.createQuery("delete from LogEntry log "
+ "where log.year < :year "
+ "or (log.year = :year and log.month < :month) "
+ "or (log.year = :year and log.month = :month and log.dayOfMonth <= :dayOfMonth");
deleteQuery.setParameter("year", year);
deleteQuery.setParameter("month", month);
deleteQuery.setParameter("dayOfMonth", dayOfMonth);
int deleteCount = deleteQuery.executeUpdate();
我必须定义6个单独的命名参数吗?引用和javadoc没有明确地解决这种情况。我正在我的环境中尝试它(Glassfish / Eclipselink),但我希望我提出的任何最终解决方案都可以在JPA实现中移植。