本文整理汇总了Java中org.hibernate.Query.iterate方法的典型用法代码示例。如果您正苦于以下问题:Java Query.iterate方法的具体用法?Java Query.iterate怎么用?Java Query.iterate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.Query
的用法示例。
在下文中一共展示了Query.iterate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadInstructorAvailabilities
import org.hibernate.Query; //导入方法依赖的package包/类
private void loadInstructorAvailabilities(org.hibernate.Session hibSession, String puids) {
Query q = hibSession.createQuery("select distinct i.externalUniqueId, a from ClassInstructor ci inner join ci.instructor i inner join ci.classInstructing.assignments a " +
"where ci.lead = true and i.externalUniqueId in ("+puids+") and a.solution.owner.session.uniqueId=:sessionId and a.solution.commited=true and a.solution.owner.uniqueId not in ("+iSolverGroupIds+")");
q.setLong("sessionId",iSessionId.longValue());
for (Iterator i=q.iterate();i.hasNext();) {
Object[] x = (Object[])i.next();
String puid = (String)x[0];
Assignment a = (Assignment)x[1];
InstructorConstraint ic = (InstructorConstraint)iInstructors.get(puid);
Placement p = a.getPlacement();
ic.setNotAvailable(p);
if (!iLectures.containsKey(a.getClassId())) {
iLectures.put(a.getClassId(), p.variable());
getModel().addVariable(p.variable());
}
}
}
示例2: loadRoomAvailabilities
import org.hibernate.Query; //导入方法依赖的package包/类
private void loadRoomAvailabilities(org.hibernate.Session hibSession, String roomids) {
Query q = hibSession.createQuery("select distinct r.uniqueId, a from Location r inner join r.assignments as a "+
"where r.uniqueId in ("+roomids+") and a.solution.owner.session.uniqueId=:sessionId and a.solution.commited=true and a.solution.owner.uniqueId not in ("+iSolverGroupIds+") and r.ignoreRoomCheck = false");
q.setLong("sessionId",iSessionId.longValue());
for (Iterator i=q.iterate();i.hasNext();) {
Object[] x = (Object[])i.next();
Long roomId = (Long)x[0];
Assignment a = (Assignment)x[1];
Placement p = a.getPlacement();
RoomConstraint rc = (RoomConstraint)iRooms.get(roomId);
rc.setNotAvailable(p);
if (!iLectures.containsKey(a.getClassId())) {
iLectures.put(a.getClassId(), p.variable());
getModel().addVariable(p.variable());
}
}
}