I have a named query:- @NamedQueries ( { @NamedQuery(name="byOwners", query="select e from SchedulerEntry e where e.owner.id in ( :loginIdList )") })
I am calling it like this:- public List<SchedulerEntry> findEntriesFor(List<Long> owners) { Query query = getCurrentSession().getNamedQuery("byOwners"); query.setParameter("loginIdList", loginIds); List<SchedulerEntry> result = query.list(); return result; }
I get this error:- Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Long at org.hibernate.type.LongType.set(LongType.java:42) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116) at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
I think I must be doing something stupid but I can't figure out where.
Could someone please tell me where I am going wrong?
|