I'm assuming Event.eventRef is a String.
You could do the following:
Code:
String queryStr = "select e.id from Event as e where e.eventRef in (";
String[] questionMarks = new String[refsList.size()];
Arrays.fill(questionMarks, "?);
queryStr += StringUtils.join(questionMarks, ",");
queryStr += ")";
Where StringUtils.join (from apache-commons) takes all the elements in the array and concatenates them with commas.
By the way if you're using Spring, I think you can pass a List as a parameter value and it gets handled correctly (not sure).
Also you could use the Criteria API:
Code:
Criteria c = Session.createCriteria(Event.class);
c.add(Restrictions.in("eventRef", refsList);
c.list();