hibernate批量删除时出现的问题
以下是我的批量删除的代码:
String[] studentIDs = request.getParameterValues("VoteOption1");
Collection entities = new ArrayList();
for (int i = 0; i < studentIDs.length; i++) {
T_student student = t_studentDAO.read(Integer.parseInt(studentIDs[i]));
entities.add(student);
}
t_studentDAO.deleteAll(entities);
以下是进行操作时出现的异常信息:
严重: Servlet.service() for servlet action threw exception
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:410)
at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:40)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
请大家帮忙看看是哪里的问题,谢谢!