Hibernate version: 3.2.4sp1
I am trying to use "all elements" expression in HQL and pass it a parameterList of entities, like this:
Code:
Object result = RequestContext.getHibernateSession().createQuery(
"select 1 from CalendarEventPersonImpl cal where publicEvent = true and creator = all elements(:persons) and calendarEventType.id IN (:calendarEventTypeList) and startTime < current_timestamp() and endTime > current_timestamp()")
.setParameterList("persons", persons)
.setParameterList("calendarEventTypeList", new String[] {"EVENT_HOLIDAY", "EVENT_ABSENCE", "EVENT_VACATION"})
.setMaxResults(1)
.uniqueResult();
(I am trying to get information if all persons in the list are currently absent).
But executing this I get the following error message back:
Code:
expecting IDENT, found ':' near line 1, column 125 [select 1 from org.comp.organization.CalendarEventPersonImpl cal where publicEvent = true and creator = all elements(:persons) and calendarEventType.id IN (:calendarEventTypeList) and startTime < current_timestamp() and endTime > current_timestamp()]
Obviously I am using "all elements" expression the wrong way. Could not find much example code in docs, all I could find is an example to pass a collection to it directly, not via parameter.
Is it possible at all?