本文整理匯總了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());
}
}
}