List of usage examples for org.hibernate FlushMode MANUAL
FlushMode MANUAL
To view the source code for org.hibernate FlushMode MANUAL.
Click Source Link
From source file:org.unitime.banner.model.BannerSection.java
License:Apache License
public static BannerSection findBannerSectionForClassAndCourseOfferingCacheable(Class_ clazz, CourseOffering courseOffering, Session hibSession) { if (clazz == null || courseOffering == null) { return (null); }//from w ww.ja va2s .c o m return ((BannerSection) hibSession.createQuery( "select distinct bsc.bannerSection from BannerSectionToClass as bsc where bsc.bannerSection.bannerConfig.bannerCourse.courseOfferingId = :courseOfferingId " + " and bsc.classId = :classId") .setLong("classId", clazz.getUniqueId().longValue()) .setLong("courseOfferingId", courseOffering.getUniqueId().longValue()) .setFlushMode(FlushMode.MANUAL).setCacheable(true).uniqueResult()); }
From source file:org.unitime.banner.model.BannerSection.java
License:Apache License
public static BannerSection findBannerSectionForBannerCourseAndClass(BannerCourse bannerCourse, Class_ clazz) { BannerSectionDAO bsDao = new BannerSectionDAO(); if (clazz == null || bannerCourse == null) { return (null); }//w ww . j a v a2s. co m String qs = "select distinct bsc.bannerSection from BannerSectionToClass bsc where bsc.classId = :classId and bsc.bannerSection.bannerConfig.bannerCourse.uniqueId = :bannerCourseId"; return ((BannerSection) bsDao.getQuery(qs).setLong("classId", clazz.getUniqueId().longValue()) .setLong("bannerCourseId", bannerCourse.getUniqueId().longValue()).setFlushMode(FlushMode.MANUAL) .uniqueResult()); }
From source file:org.unitime.banner.model.BannerSession.java
License:Apache License
public static BannerSession findBannerSessionForSession(Long acadSessionId, org.hibernate.Session hibSession) { if (acadSessionId == null) { return (null); }/*from w ww . ja va2 s. com*/ org.hibernate.Session querySession = hibSession; if (querySession == null) { querySession = BannerSessionDAO.getInstance().getSession(); } return ((BannerSession) querySession .createQuery("from BannerSession bs where bs.session.uniqueId = :sessionId") .setFlushMode(FlushMode.MANUAL).setLong("sessionId", acadSessionId.longValue()).setCacheable(true) .uniqueResult()); }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
private void initClassesIfNecessary(Session hibSession, Class_ clazz) { if (classes == null) { classes = new HashSet<Class_>(); if (getColleagueSectionToClasses() != null && !getColleagueSectionToClasses().isEmpty()) { Session querySession;/*from ww w. ja v a 2 s. c o m*/ if (hibSession == null) { querySession = Class_DAO.getInstance().getSession(); } else { querySession = hibSession; } for (ColleagueSectionToClass csc : getColleagueSectionToClasses()) { if (clazz != null && csc.getClassId().equals(clazz.getUniqueId())) { classes.add(clazz); } else { Class_ c = (Class_) querySession.createQuery("from Class_ c where c.uniqueId = :classId") .setLong("classId", csc.getClassId().longValue()).setFlushMode(FlushMode.MANUAL) .uniqueResult(); if (c != null) { classes.add(c); } } } } } }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
public static ColleagueSection findColleagueSectionForClassAndCourseExternalId(Class_ clazz, String courseExternalId, Session hibSession, org.unitime.timetable.model.Session acadSession) { return ((ColleagueSection) hibSession.createQuery( "select cs from ColleagueSection cs inner join cs.colleagueSectionToClasses as csc where cs.courseOfferingId = " + " (select co.uniqueId from CourseOffering co where co.externalUniqueId = :courseExternalId and co.instructionalOffering.session.uniqueId = :sessionId)" + " and csc.classId = :classId") .setLong("classId", clazz.getUniqueId().longValue()) .setLong("sessionId", acadSession.getUniqueId().longValue()) .setString("courseExternalId", courseExternalId).setFlushMode(FlushMode.MANUAL).setCacheable(false) .uniqueResult());/*from ww w. j av a 2 s .c o m*/ }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
@SuppressWarnings("unchecked") public static List<ColleagueSection> findColleagueSectionsForInstructionalOffering( InstructionalOffering instructionalOffering, Session hibSession) { return ((List<ColleagueSection>) hibSession.createQuery( "select cs from ColleagueSection cs, CourseOffering co where co.instructionalOffering = :instrOfferId and cs.courseOfferingId = co.uniqueId") .setLong("instrOfferId", instructionalOffering.getUniqueId().longValue()) .setFlushMode(FlushMode.MANUAL).list()); }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
private int countColleagueSectionsFor(Long classId, Session hibSession) { if (classId == null) { return (0); }/* w ww. ja v a 2 s. c om*/ Session querySession = hibSession; if (querySession == null) { querySession = Class_DAO.getInstance().getSession(); } return ((Long) querySession .createQuery("select count(csc) from ColleagueSectionToClass csc where csc.classId = :classId") .setLong("classId", classId.longValue()).setFlushMode(FlushMode.MANUAL).uniqueResult()).intValue(); }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
@SuppressWarnings("unchecked") public static List<ColleagueSection> findColleagueSectionsForClass(Class_ clazz, Session hibSession) { return ((List<ColleagueSection>) hibSession.createQuery( "select distinct csc.colleagueSection from ColleagueSectionToClass as csc where csc.classId = :classId") .setLong("classId", clazz.getUniqueId().longValue()).setFlushMode(FlushMode.MANUAL).list()); }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
@SuppressWarnings("unchecked") public static List<ColleagueSection> findNotDeletedColleagueSectionsForClass(Class_ clazz, Session hibSession) { return ((List<ColleagueSection>) hibSession.createQuery( "select distinct csc.colleagueSection from ColleagueSectionToClass as csc where csc.colleagueSection.deleted = false and csc.classId = :classId") .setLong("classId", clazz.getUniqueId().longValue()).setFlushMode(FlushMode.MANUAL).list()); }
From source file:org.unitime.colleague.model.ColleagueSection.java
License:Apache License
@SuppressWarnings("unchecked") public static List<ColleagueSection> findColleagueSectionsForInstrOfferingConfig( InstrOfferingConfig instrOfferingConfig, Session hibSession) { return ((List<ColleagueSection>) hibSession.createQuery( "select distinct csc.colleagueSection from ColleagueSectionToClass as csc, Class_ c where c.schedulingSubpart.instrOfferingConfig.uniqueId = :configId and csc.classId = c.uniqueId") .setLong("configId", instrOfferingConfig.getUniqueId().longValue()).setFlushMode(FlushMode.MANUAL) .list());//from w w w . j a v a 2 s .com }