Greetings Forum Folks,
I'm attempting to do some EJB QL on Jboss 4.0.4 compiled for ejb3 and I've run into a problem. The query I am attempting is the following:
Query query = entityManager.createQuery("FROM ProjectEstimate AS pe WHERE ((pe.subStartDate IS NOT NULL and pe.subEndDate IS NULL and :date >= pe.subStartDate) or (pe.subEndDate IS NOT NULL and pe.subStartDate IS NULL and :date <= pe.subEndDate) or (pe.subStartDate IS NOT NULL and pe.subEndDate IS NOT NULL and :date >= pe.subStartDate and :date <= pe.subEndDate)) ORDER BY pe.name "); query.setParameter("date", new java.util.Date());
WHERE (pe.subStartDate IS NOT NULL) and (pe.subEndDate IS NULL) and (:date >= pe.subStartDate) or (pe.subEndDate IS NOT NULL) and (pe.subStartDate IS NULL) and (:date <= pe.subEndDate) or (pe.subStartDate IS NOT NULL) and (pe.subEndDate IS NOT NULL) and (:date >= pe.subStartDate and :date <= pe.subEndDate)
A WHERE clause consists of a conditional expression, which is evaluated from left to right within a precedence level.
You can change the order of evaluation by using parentheses.
I am having the same problem with jboss 4.3.0.GA - is this a known issue?