List of usage examples for org.hibernate FetchMode JOIN
FetchMode JOIN
To view the source code for org.hibernate FetchMode JOIN.
Click Source Link
From source file:com.indicator_engine.dao.GLAQuestionDaoImpl.java
License:Open Source License
@Override @Transactional// w w w . j av a 2s . c o m public List<GLAQuestion> searchQuestionsName(String searchParameter, boolean exactSearch, String colName, String sortDirection, boolean sort) { if (!exactSearch) searchParameter = "%" + searchParameter + "%"; Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(GLAQuestion.class); criteria.setFetchMode("glaIndicators", FetchMode.JOIN); criteria.setFetchMode("glaQuestionProps", FetchMode.JOIN); if (!exactSearch) criteria.add(Restrictions.ilike("question_name", searchParameter)); else criteria.add(Restrictions.eq("question_name", searchParameter)); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); if (sort) { if (sortDirection.equals("asc")) criteria.addOrder(Order.asc(colName)); else criteria.addOrder(Order.desc(colName)); } return criteria.list(); }
From source file:com.indicator_engine.dao.GLAUserDaoImpl.java
License:Open Source License
@Override @Transactional(readOnly = true)//from w ww . j a v a2 s.com public List<GLAUser> loadUsersRange(long startRange, long endRange) { Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(GLAUser.class); criteria.setFetchMode("events", FetchMode.JOIN); criteria.add(Restrictions.ge("id", startRange)); criteria.add(Restrictions.le("id", endRange)); return criteria.list(); }
From source file:com.indicator_engine.dao.GLAUserDaoImpl.java
License:Open Source License
@Override @Transactional(readOnly = true)/*from w w w .ja v a 2 s.c o m*/ public List<GLAUser> loadAll(String colName, String sortDirection, boolean sort) { Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(GLAUser.class); criteria.setFetchMode("events", FetchMode.JOIN); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); if (sort) { if (sortDirection.equals("asc")) criteria.addOrder(Order.asc(colName)); else criteria.addOrder(Order.desc(colName)); } return criteria.list(); }
From source file:com.indicator_engine.dao.GLAUserDaoImpl.java
License:Open Source License
@Override @Transactional(readOnly = true)/*from w ww . ja va2 s .co m*/ public List<GLAUser> searchLikeUsers(String searchParameter, String colName, String sortDirection, boolean sort) { searchParameter = "%" + searchParameter + "%"; Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(GLAUser.class); criteria.setFetchMode("events", FetchMode.JOIN); criteria.add(Restrictions.ilike("username", searchParameter)); if (sort) { if (sortDirection.equals("asc")) criteria.addOrder(Order.asc(colName)); else criteria.addOrder(Order.desc(colName)); } return criteria.list(); }
From source file:com.indicator_engine.dao.SecurityRoleEntityDaoImpl.java
License:Open Source License
@Override @Transactional// www . j av a2s . co m public List<SecurityRoleEntity> searchRolesByID(long UID) { Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(SecurityRoleEntity.class); criteria.setFetchMode("userCredentials", FetchMode.JOIN); criteria.createAlias("userCredentials", "uc"); criteria.add(Restrictions.eq("uc.uid", UID)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.AppraisalProgramEmpAssesorDaoImpl.java
@Override public List<AppraisalProgramEmpAssesor> getAllBy(Long appraisalId, Long empId) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("appraisalProgram", "ap"); criteria.createAlias("empDataByEmpId", "em"); criteria.setFetchMode("appraisalProgram", FetchMode.JOIN); criteria.setFetchMode("empDataByAssesorEmpId", FetchMode.JOIN); criteria.setFetchMode("empDataByAssesorEmpId.jabatanByJabatanId", FetchMode.JOIN); criteria.setFetchMode("empDataByAssesorEmpId.bioData", FetchMode.JOIN); criteria.add(Restrictions.eq("ap.id", appraisalId)); criteria.add(Restrictions.eq("em.id", empId)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.ApprovalDefinitionLoanDaoImpl.java
@Override public List<ApprovalDefinitionLoan> getByLoanId(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition", FetchMode.JOIN); criteria.add(Restrictions.eq("loanNewSchema.id", id)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.ApprovalDefinitionLoanDaoImpl.java
@Override public List<ApprovalDefinitionLoan> getByLoanIdWithDetail(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.setFetchMode("loanNewSchema", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition.hrmUserByApproverIndividual", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition.hrmUserByOnBehalfIndividual", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition.jabatanByApproverPosition", FetchMode.JOIN); criteria.setFetchMode("approvalDefinition.jabatanByOnBehalfPosition", FetchMode.JOIN); criteria.add(Restrictions.eq("loanNewSchema.id", id)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.BatchStepExecutionDaoImpl.java
@Override public List<BatchStepExecution> getExitMessageByJobId(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("batchJobExecution", "bs", JoinType.INNER_JOIN); criteria.add(Restrictions.eq("bs.jobExecutionId", id)); criteria.setFetchMode("batchJobExecution", FetchMode.JOIN); criteria.setFetchMode("batchJobExecution.batchJobInstance", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.BatchStepExecutionDaoImpl.java
@Override public Long getTotalExitMessageByParam(Long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("batchJobExecution", "bs", JoinType.INNER_JOIN); criteria.add(Restrictions.eq("bs.jobExecutionId", id)); criteria.setFetchMode("batchJobInstance", FetchMode.JOIN); criteria.setFetchMode("batchJobExecution", FetchMode.JOIN); return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult(); }