當前位置: 首頁>>代碼示例>>Java>>正文


Java Query.setLong方法代碼示例

本文整理匯總了Java中org.hibernate.Query.setLong方法的典型用法代碼示例。如果您正苦於以下問題:Java Query.setLong方法的具體用法?Java Query.setLong怎麽用?Java Query.setLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.Query的用法示例。


在下文中一共展示了Query.setLong方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findLastNChanges

import org.hibernate.Query; //導入方法依賴的package包/類
public static List findLastNChanges(Long sessionId, Long managerId, Long subjAreaId, Long departmentId, int n) {
    try {
        org.hibernate.Session hibSession = new ChangeLogDAO().getSession(); 
        Query q = hibSession.createQuery(
                    "select ch from ChangeLog ch where " +
                    "ch.session.uniqueId=:sessionId " +
                    (managerId==null?"":"and ch.manager.uniqueId=:managerId ") +
                    (subjAreaId==null?"":"and ch.subjectArea.uniqueId=:subjAreaId ") +
                    (departmentId==null?"":"and ch.department.uniqueId=:departmentId ") + 
                    "order by ch.timeStamp desc");
        q.setLong("sessionId", sessionId.longValue());
        if (managerId!=null) q.setLong("managerId",managerId.longValue());
        if (subjAreaId!=null) q.setLong("subjAreaId",subjAreaId.longValue());
        if (departmentId!=null) q.setLong("departmentId",departmentId.longValue());
        q.setMaxResults(n);
        q.setCacheable(true);
        return q.list();
    } catch (Exception e) {
        Debug.error(e);
    }
    return null;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:ChangeLog.java

示例2: getPendingNotificationCount

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
   public long getPendingNotificationCount(Long lessonId, Integer userId) {
String query = EventDAOHibernate.COUNT_PENDING_NOTIFICATIONS;
if (lessonId != null) {
    query += " AND s.event.eventSessionId = ?";
}
Query queryObject = getSession().createQuery(query);
queryObject.setInteger(0, userId);
if (lessonId != null) {
    queryObject.setLong(1, lessonId);
}
return (Long) queryObject.uniqueResult();
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:EventDAOHibernate.java

示例3: getStatsMarksBySession

import org.hibernate.Query; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
   @Override
   public Object[] getStatsMarksBySession(Long sessionId) {

Query query = getSession().createSQLQuery(FIND_MARK_STATS_FOR_SESSION)
	.addScalar("min_grade", FloatType.INSTANCE)
	.addScalar("avg_grade", FloatType.INSTANCE)
	.addScalar("max_grade", FloatType.INSTANCE);
query.setLong("sessionId", sessionId);
List list = query.list();
if ((list == null) || (list.size() == 0)) {
    return null;
} else {
    return (Object[]) list.get(0);
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:AssessmentUserDAOHibernate.java

示例4: createModel

import org.hibernate.Query; //導入方法依賴的package包/類
public static TimetableGridModel createModel(String solutionIdsStr, SubjectArea sa, org.hibernate.Session hibSession, TimetableGridContext context) {
  	TimetableGridModel model = new TimetableGridModel(ResourceType.SUBJECT_AREA.ordinal(), sa.getUniqueId());
  	model.setName(sa.getSubjectAreaAbbreviation());
  	model.setFirstDay(context.getFirstDay());
  	model.setFirstSessionDay(context.getFirstSessionDay());
  	model.setFirstDate(context.getFirstDate());

  	Query q = hibSession.createQuery("select distinct a from Assignment as a inner join a.clazz.schedulingSubpart.instrOfferingConfig.instructionalOffering.courseOfferings as o inner join o.subjectArea as sa where " +
		"a.solution.uniqueId in ("+solutionIdsStr+") and sa.uniqueId=:resourceId and " +
		"o.isControl=true");
q.setCacheable(true);
q.setLong("resourceId", sa.getUniqueId());
List assignments = q.list();

createCells(model, assignments, hibSession, context, false);
model.setSize(assignments.size());
model.setUtilization(countUtilization(assignments, context));

return model;
  }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:21,代碼來源:TimetableGridSolutionHelper.java

示例5: getDistPrefsTableAsPdf

import org.hibernate.Query; //導入方法依賴的package包/類
public void getDistPrefsTableAsPdf(OutputStream out, HttpServletRequest request, SessionContext context, Long subjectAreaId, String courseNbr, Long examTypeId) throws Exception {
    
    Query q = new DistributionPrefDAO().getSession().createQuery(
            "select distinct dp from DistributionPref dp " +
            "inner join dp.distributionObjects do, Exam x inner join x.owners o " +
            "where "+
            (courseNbr==null || courseNbr.trim().length()==0?"":courseNbr.indexOf('*')>=0?"o.course.courseNbr like :courseNbr and ":"o.course.courseNbr=:courseNbr and")+
            (subjectAreaId==null?"":" o.course.subjectArea.uniqueId=:subjectAreaId and ")+
            "dp.distributionType.examPref = true and "+
            "do.prefGroup = x and x.session.uniqueId=:sessionId and x.examType.uniqueId=:examTypeId")
            .setLong("sessionId", context.getUser().getCurrentAcademicSessionId())
            .setLong("examTypeId", examTypeId);
    if (subjectAreaId!=null)
        q.setLong("subjectAreaId", subjectAreaId);
    if (courseNbr!=null && courseNbr.trim().length()!=0)
        q.setString("courseNbr", courseNbr.trim().replaceAll("\\*", "%"));
    List distPrefs = q.setCacheable(true).list();

    toPdfTable(out, request, context, distPrefs, examTypeId); 
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:21,代碼來源:ExamDistributionPrefsTableBuilder.java

示例6: findBySessionSubjAreaAbbvCourseNbrTitle

import org.hibernate.Query; //導入方法依賴的package包/類
public static CourseOffering findBySessionSubjAreaAbbvCourseNbrTitle(Long acadSessionId, String subjAreaAbbv, String courseNbr, String title) {

        InstructionalOfferingDAO iDao = new InstructionalOfferingDAO();
        org.hibernate.Session hibSession = iDao.getSession();
        
        String sql = " from CourseOffering co " +
                     " where co.subjectArea.subjectAreaAbbreviation=:subjArea" +
                     " and co.courseNbr = :crsNbr" +
                     " and co.title = :title" +
                     " and co.instructionalOffering.session.uniqueId = :acadSessionId";
        Query query = hibSession.createQuery(sql);
        query.setString("crsNbr", courseNbr);
        query.setString("subjArea", subjAreaAbbv);
        query.setLong("acadSessionId", acadSessionId.longValue());
        query.setString("title", title);
        
        return (CourseOffering)query.uniqueResult();

    }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:CourseOffering.java

示例7: isDeptInstructorUnique

import org.hibernate.Query; //導入方法依賴的package包/類
/**
   * Checks that combination of Instructor/Dept 
   * does not already exist
   * @param frm
   * @return
   */
  protected boolean isDeptInstructorUnique(
          InstructorEditForm frm, 
       HttpServletRequest request ) {
      
      String query = "from DepartmentalInstructor " +
      				"where externalUniqueId=:puid and department.uniqueId=:deptId";
      if (frm.getInstructorId()!=null && frm.getInstructorId().trim().length()>0) {
          query += " and uniqueId!=:uniqueId";
      }
      
      DepartmentalInstructorDAO ddao = new DepartmentalInstructorDAO();
      org.hibernate.Session hibSession = ddao.getSession();
      
HttpSession httpSession = request.getSession();
String deptId = (String) httpSession.getAttribute(Constants.DEPT_ID_ATTR_NAME);
     
      Query q = hibSession.createQuery(query);
      q.setString("puid", frm.getPuId().trim());
      q.setLong("deptId", Long.parseLong(deptId));
      if (frm.getInstructorId()!=null && frm.getInstructorId().trim().length()>0) {
          q.setString("uniqueId", frm.getInstructorId().trim());
      }
      
      return (q.list().size()==0);
  }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:32,代碼來源:InstructorAction.java

示例8: 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());
	}
}
  }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:18,代碼來源:TimetableDatabaseLoader.java

示例9: getStaffByDept

import org.hibernate.Query; //導入方法依賴的package包/類
/**
 * 
 * @param deptCode
 * @return
 */
public static List getStaffByDept(String deptCode, Long acadSessionId) throws Exception {	
	if (deptCode == null){
		return(null);
	}
	
	Query q = StaffDAO.getInstance().getSession().createQuery(
			"select distinct s from Staff s where s.dept=:deptCode and " +
			"(select di.externalUniqueId from DepartmentalInstructor di " +
			"where di.department.deptCode=:deptCode and di.department.session.uniqueId=:sessionId and di.externalUniqueId = s.externalUniqueId ) is null");
	q.setString("deptCode", deptCode);
	q.setLong("sessionId", acadSessionId);
	q.setCacheable(true);
	return (q.list());
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:20,代碼來源:Staff.java

示例10: getLatest

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
   public List getLatest(ChatSession chatSession, Integer max, boolean orderAsc) {
try {
    Query query = getSessionFactory().getCurrentSession().createQuery(
	    ChatMessageDAO.SQL_QUERY_FIND_MESSAGE_BY_SESSION_ORDER_BY_DATE + (orderAsc ? "asc" : "desc"));
    query.setLong(0, chatSession.getUid());
    if (max != null) {
	query.setMaxResults(max);
    }
    return query.list();
} catch (HibernateException he) {
    logger.error("getLatest: hibernate exception");
    return null;
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:ChatMessageDAO.java

示例11: getArchivedEmailNotificationRecipients

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
   @SuppressWarnings("unchecked")
   public List<User> getArchivedEmailNotificationRecipients(Long emailNotificationUid, Integer limit, Integer offset) {
Query queryObject = getSession().createQuery(EventDAOHibernate.GET_ARCHIVED_EMAIL_NOTIFICATION_RECIPIENTS);
queryObject.setLong(0, emailNotificationUid);
if (limit != null) {
    queryObject.setMaxResults(limit);
}
if (offset != null) {
    queryObject.setFirstResult(offset);
}
return queryObject.list();
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:EventDAOHibernate.java

示例12: getLessonForActivity

import org.hibernate.Query; //導入方法依賴的package包/類
/**
    * Get the lesson that applies to this activity. Not all activities have an attached lesson.
    */
   @Override
   public Lesson getLessonForActivity(long activityId) {
Query query = getSession().createQuery(LessonDAO.FIND_LESSON_FOR_ACTIVITY);
query.setLong("activityId", activityId);
return (Lesson) query.uniqueResult();
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:LessonDAO.java

示例13: getTransitionByToActivityID

import org.hibernate.Query; //導入方法依賴的package包/類
/**
    * (non-Javadoc)
    * 
    * @see org.lamsfoundation.lams.learningdesign.dao.ITransitionDAO#getTransitionByToActivityID(java.lang.Long)
    */
   @Override
   public Transition getTransitionByToActivityID(Long toActivityID) {
if (toActivityID != null) {
    Query query = getSessionFactory().getCurrentSession().createQuery(FIND_BY_TO_ACTIVITY);
    query.setLong(0, toActivityID.longValue());
    return (Transition) query.uniqueResult();
}
return null;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:TransitionDAO.java

示例14: getCompetenceMapping

import org.hibernate.Query; //導入方法依賴的package包/類
@Override
   public CompetenceMapping getCompetenceMapping(ToolActivity toolActivity, Competence competence) {
if (toolActivity != null && competence != null) {
    Long activityId = toolActivity.getActivityId();
    Long competenceId = competence.getCompetenceId();
    Query query = getSession().createQuery(LOAD_COMPETENCE_MAPPING_BY_ACTIVITY_AND_COMPETENCE);
    query.setLong(0, competenceId);
    query.setLong(1, activityId.longValue());
    return (CompetenceMapping) query.uniqueResult();
}
return null;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:CompetenceMappingDAO.java

示例15: getCompetence

import org.hibernate.Query; //導入方法依賴的package包/類
/**
    * @see org.lamsfoundation.lams.competence.dao.ICompetencelDAO#getCompetence()
    */
   @Override
   public Competence getCompetence(LearningDesign design, String competenceTitle) {
if (design != null && competenceTitle != null) {
    Long designID = design.getLearningDesignId();
    Query query = getSessionFactory().getCurrentSession().createQuery(LOAD_COMPETENCE_BY_LDID_AND_TITLE);
    query.setString(0, competenceTitle);
    query.setLong(1, designID.longValue());
    return (Competence) query.uniqueResult();
}
return null;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:CompetenceDAO.java


注:本文中的org.hibernate.Query.setLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。