List of usage examples for org.hibernate FetchMode LAZY
FetchMode LAZY
To view the source code for org.hibernate FetchMode LAZY.
Click Source Link
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer warningNoProsecutionCount(Integer roadOperationId) { /* Get Count of Summons For Road Operation */ Criteria criteriaWarningNoProsecution = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(WarningNoProsecutionDO.class, "w"); criteriaWarningNoProsecution.createAlias("w.roadCheckOffenceOutcome", "rout", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rout.roadCheckOffence", "roff", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("roff.roadCheck", "rchk", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rchk.compliance", "comp", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("comp.roadOperation", "rop", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.add(Restrictions.eq("rop.roadOperationId", roadOperationId)); criteriaWarningNoProsecution.setProjection(Projections.rowCount()); criteriaWarningNoProsecution.setFetchMode("w", FetchMode.LAZY); criteriaWarningNoProsecution.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaWarningNoProsecution.list().iterator(); Integer warningNoProsecutionCount = (Integer) iterator.next(); return warningNoProsecutionCount; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer warningNoProsecutionTeamCount(Integer roadOperationId, Integer teamId) { /* Get Count of Summons For Road Operation */ Criteria criteriaWarningNoProsecution = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(WarningNoProsecutionDO.class, "w"); criteriaWarningNoProsecution.createAlias("w.roadCheckOffenceOutcome", "rout", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rout.roadCheckOffence", "roff", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("roff.roadCheck", "rchk", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rchk.compliance", "comp", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("comp.roadOperation", "rop", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.add(Restrictions.eq("rop.roadOperationId", roadOperationId)); if (this.getStaffIdForTeam(teamId) != null) { criteriaWarningNoProsecution.add(Restrictions.in("w.taStaff.staffId", this.getStaffIdForTeam(teamId))); criteriaWarningNoProsecution.setProjection(Projections.rowCount()); criteriaWarningNoProsecution.setFetchMode("w", FetchMode.LAZY); criteriaWarningNoProsecution.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaWarningNoProsecution.list().iterator(); Integer warningNoProsecutionCount = (Integer) iterator.next(); return warningNoProsecutionCount; } else// ww w. j a va 2 s . c o m return 0; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer warningNoProsecutionCount(Integer roadOperationId, Integer personId, String personType) { /* Get Count of Summons For Road Operation */ Criteria criteriaWarningNoProsecution = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(WarningNoticeDO.class, "w"); criteriaWarningNoProsecution.createAlias("w.roadCheckOffenceOutcome", "rout", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rout.roadCheckOffence", "roff", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("roff.roadCheck", "rchk", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("rchk.compliance", "comp", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.createAlias("comp.roadOperation", "rop", Criteria.LEFT_JOIN); criteriaWarningNoProsecution.add(Restrictions.eq("rop.roadOperationId", roadOperationId)); if (personType.equalsIgnoreCase(Constants.PersonType.TA_STAFF)) { criteriaWarningNoProsecution.createAlias("w.taStaff", "ta"); criteriaWarningNoProsecution.createAlias("ta.person", "p"); } else {// w w w. j av a2 s. c om return -1; } criteriaWarningNoProsecution.add(Restrictions.eq("p.personId", personId)); criteriaWarningNoProsecution.setProjection(Projections.rowCount()); criteriaWarningNoProsecution.setFetchMode("w", FetchMode.LAZY); criteriaWarningNoProsecution.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaWarningNoProsecution.list().iterator(); Integer warningNoProsecutionCount = (Integer) iterator.next(); return warningNoProsecutionCount; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer complianceCount(Integer roadOperationId) { /* Get Count of Summons For Road Operation */ Criteria criteriaCompliance = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(ComplianceDO.class, "c"); criteriaCompliance.add(Restrictions.eq("c.roadOperation.roadOperationId", roadOperationId)); criteriaCompliance.setProjection(Projections.rowCount()); criteriaCompliance.setFetchMode("c", FetchMode.LAZY); criteriaCompliance.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaCompliance.list().iterator(); Integer complainceCount = (Integer) iterator.next(); return complainceCount; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer complianceTeamCount(Integer roadOperationId, Integer teamId) { /* Get Count of Summons For Road Operation */ Criteria criteriaCompliance = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(ComplianceDO.class, "c"); criteriaCompliance.add(Restrictions.eq("c.roadOperation.roadOperationId", roadOperationId)); if (this.getStaffIdForTeam(teamId) != null) { criteriaCompliance.add(Restrictions.in("c.taStaff.staffId", this.getStaffIdForTeam(teamId))); criteriaCompliance.setProjection(Projections.rowCount()); criteriaCompliance.setFetchMode("c", FetchMode.LAZY); criteriaCompliance.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaCompliance.list().iterator(); Integer complainceCount = (Integer) iterator.next(); return complainceCount; } else/*from w w w . j a v a2 s .co m*/ return 0; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
private Integer complianceCount(Integer roadOperationId, Integer personId, String personType) { /* Get Count of Summons For Road Operation */ Criteria criteriaCompliance = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(ComplianceDO.class, "c"); criteriaCompliance.add(Restrictions.eq("c.roadOperation.roadOperationId", roadOperationId)); if (personType.equalsIgnoreCase(Constants.PersonType.TA_STAFF)) { criteriaCompliance.createAlias("c.taStaff", "ta"); criteriaCompliance.createAlias("ta.person", "p"); } else {/*from w ww . j a v a2 s.c o m*/ return -1; } criteriaCompliance.add(Restrictions.eq("p.personId", personId)); criteriaCompliance.setProjection(Projections.rowCount()); criteriaCompliance.setFetchMode("c", FetchMode.LAZY); criteriaCompliance.setFlushMode(FlushMode.ALWAYS); Iterator iterator = criteriaCompliance.list().iterator(); Integer complainceCount = (Integer) iterator.next(); return complainceCount; }
From source file:fsl.ta.toms.roms.dao.impl.ReportDAOImpl.java
/*************************** * UR-057 //from w w w . jav a 2 s . c om *********************/ private Integer absentPersonTypeCount(Integer roadOperationId, String personType) { /* Get Count of Absent Persons */ Criteria criteriaAssignedPersons = this.hibernateTemplate.getSessionFactory().getCurrentSession() .createCriteria(AssignedPersonDO.class, "a"); List<Integer> teamIds = getTeamIdsForRoadOp(roadOperationId); if (teamIds != null && teamIds.size() > 0) { criteriaAssignedPersons.add(Restrictions.in("a.assignedPersonKey.team.teamId", teamIds)); criteriaAssignedPersons.add(Restrictions.eq("a.assignedPersonKey.personType.personTypeId", personType)); } criteriaAssignedPersons.add(Restrictions.eq("a.attended", "n").ignoreCase()); criteriaAssignedPersons.setProjection(Projections.count("a.attended")); criteriaAssignedPersons.setFetchMode("a", FetchMode.LAZY); Iterator iterator = criteriaAssignedPersons.list().iterator(); Integer AbsentPersonTypeCount = (Integer) iterator.next(); criteriaAssignedPersons.setFlushMode(FlushMode.ALWAYS); return AbsentPersonTypeCount; }
From source file:mx.ipn.escom.repositorios.impl.CasaRepositorioImpl.java
@Override public List<Casa> buscarPorCasaCentro(String esCentro) { return (List<Casa>) sessionFactory.getCurrentSession().createCriteria(Casa.class) .setFetchMode(esCentro, FetchMode.LAZY).list(); }