本文整理汇总了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;
}
示例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();
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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());
}
}
}
示例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());
}
示例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;
}
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}