List of usage examples for org.hibernate Criteria createAlias
public Criteria createAlias(String associationPath, String alias) throws HibernateException;
From source file:com.indicator_engine.dao.GLAIndicatorDaoImpl.java
License:Open Source License
@Override @Transactional/*from w ww .j ava2 s. com*/ public long findQuestionID(long indicatorID) { Session session = factory.getCurrentSession(); Criteria criteria = session.createCriteria(GLAIndicator.class); criteria.setFetchMode("glaIndicatorProps", FetchMode.JOIN); criteria.createAlias("glaQuestions", "questions"); criteria.setFetchMode("questions", FetchMode.JOIN); criteria.add(Restrictions.eq("id", indicatorID)); criteria.setProjection(Projections.property("questions.id")); return ((Long) criteria.uniqueResult()).longValue(); }
From source file:com.indicator_engine.dao.SecurityRoleEntityDaoImpl.java
License:Open Source License
@Override @Transactional/*from w w w . j av a 2s. c om*/ 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 Long getTotalAssesorByAppraisalIAndEmpId(Long appraisalId, Long empId) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("appraisalProgram", "ap"); criteria.createAlias("empDataByEmpId", "em"); criteria.add(Restrictions.eq("ap.id", appraisalId)); criteria.add(Restrictions.eq("em.id", empId)); return (Long) criteria.setProjection(Projections.rowCount()).uniqueResult(); }
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.DepartementUnitLocationDaoImpl.java
@Override public List<DepartementUnitLocation> getByDepartementId(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("department", "dp"); criteria.add(Restrictions.eq("dp.id", id)); criteria.addOrder(Order.desc("unitKerja")); criteria.setFetchMode("unitKerja", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.DepartementUploadCaptureDaoImpl.java
@Override public List<DepartementUploadCapture> getByMecineFingerId(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("mecineFinger", "d"); criteria.add(Restrictions.eq("d.id", id)); criteria.addOrder(Order.asc("department")); criteria.setFetchMode("department", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.HrmUserDaoImpl.java
private void doSearchSpiUserByParam(HrmUserSearchParameter parameter, Criteria criteria) { if (parameter.getUserName() != null) { criteria.add(Restrictions.like("userId", parameter.getUserName(), MatchMode.ANYWHERE)); }//from w w w. j a v a 2 s . c om if (parameter.getRealName() != null) { criteria.add(Restrictions.like("realName", parameter.getRealName(), MatchMode.ANYWHERE)); } if (parameter.getRoleName() != null) { criteria.createAlias("hrmUserRoles", "h"); criteria.createAlias("h.hrmRole", "hrmRole"); criteria.add(Restrictions.like("hrmRole.roleName", parameter.getRoleName(), MatchMode.ANYWHERE)); } criteria.add(Restrictions.isNotNull("id")); }
From source file:com.inkubator.hrm.dao.impl.HrmUserRoleDaoImpl.java
@Override public List<HrmUserRole> getByUserId(long id) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("hrmUser", "su"); criteria.add(Restrictions.eq("su.id", id)); criteria.addOrder(Order.desc("hrmRole")); criteria.setFetchMode("hrmRole", FetchMode.JOIN); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.HrmUserRoleDaoImpl.java
@Override public List<HrmUserRole> getUserName(String name) { Criteria criteria = getCurrentSession().createCriteria(getEntityClass()); criteria.createAlias("hrmUser", "su"); criteria.add(Restrictions.eq("su.userId", name)); return criteria.list(); }
From source file:com.inkubator.hrm.dao.impl.JabatanDeskripsiDaoImpl.java
private void doSearchByParam(JabatanDeskripsiSearcParameter parameter, Criteria criteria) { criteria.createAlias("jabatan", "jb"); criteria.createAlias("jb.jabatan", "jbb"); if (StringUtils.isNotEmpty(parameter.getJobsName())) { criteria.add(Restrictions.like("jb.name", parameter.getJobsName(), MatchMode.ANYWHERE)); }//w w w .j av a 2 s . c o m if (StringUtils.isNotEmpty(parameter.getParentJobsName())) { criteria.add(Restrictions.like("jbb.name", parameter.getParentJobsName(), MatchMode.ANYWHERE)); } }