Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria.createAlias()


            endDate = Calendar.getInstance().getTime();

        }

        final DetachedCriteria criteria = DetachedCriteria.forClass(Hit.class);
        criteria.createAlias("hashTag", "hashTag");
        criteria.add(Restrictions.eq("hashTag.hashTagId", tagId));
        criteria.addOrder(Order.desc("hitDate"));
        criteria.add(Restrictions.between("hitDate", startDate, endDate));
        //define as a VISIT category
        criteria.add(Restrictions.eq("hitCategory", HitCategory.VISIT));
View Full Code Here


  @SuppressWarnings("unchecked")
  public List getHashTagHitsRange(final Long tagId,
      final SearchPeriods period) {

    final DetachedCriteria criteria = DetachedCriteria.forClass(Hit.class);
    criteria.createAlias("hashTag", "hashTag");
    criteria.add(Restrictions.eq("hashTag.hashTagId", tagId));
    criteria.addOrder(Order.desc("hitDate"));

    // define as a VISIT category
    criteria.add(Restrictions.eq("hitCategory", HitCategory.VISIT));
View Full Code Here

    public List<Dashboard> retrieveFavouritesDashboards(
            final UserAccount userAcc,
            final Integer maxResults,
            final Integer start){
            final DetachedCriteria criteria = DetachedCriteria.forClass(Dashboard.class);
            criteria.createAlias("userBoard","userBoard");
            criteria.add(Restrictions.eq("favorite", Boolean.TRUE));
            criteria.add(Restrictions.eq("userBoard", userAcc));
            return (List<Dashboard>) filterByMaxorStart(criteria, maxResults, start);
        }
View Full Code Here

    public List<Dashboard> retrieveDashboardbyKeyword(final String keyword,
            final UserAccount userAcc,
            final Integer maxResults,
            final Integer start){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Dashboard.class);
        criteria.createAlias("userBoard", "userBoard");
        criteria.add(Restrictions.eq("userBoard", userAcc));
        //TODO: Future update to hibernate search dashboard.
        criteria.add(Restrictions.like("pageBoardName", keyword, MatchMode.ANYWHERE));
        return (List<Dashboard>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

     * @see org.encuestame.persistence.dao.IDashboardDao#retrievePropertiesbyGadget(java.lang.Long)
     */
    @SuppressWarnings("unchecked")
    public List retrievePropertiesbyGadget(final Long gadgetId){
        final DetachedCriteria criteria = DetachedCriteria.forClass(GadgetProperties.class);
        criteria.createAlias("gadget", "gadget");
        criteria.add(Restrictions.eq("gadget.gadgetId", gadgetId));
        return getHibernateTemplate().findByCriteria(criteria);
    }

    /*
 
View Full Code Here

     * @see org.encuestame.persistence.dao.IDashboardDao#retrieveGadgetsbyDashboard(java.lang.Long)
     */
    @SuppressWarnings("unchecked")
    public List retrieveGadgetsbyDashboard(final Long boardId) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(Gadget.class);
        criteria.createAlias("dashboard","dashboard");
        criteria.add(Restrictions.eq("dashboard.boardId", boardId));
        return getHibernateTemplate().findByCriteria(criteria);
    }

    /*
 
View Full Code Here

    public final List getAnswersByQuestionId(final Long questionId) throws HibernateException {
     /*   return getHibernateTemplate().findByNamedParam("from QuestionAnswer where questions.id =:questionId ",
                                                       "questionId", questionId);*/
    final DetachedCriteria criteria = DetachedCriteria
        .forClass(QuestionAnswer.class);
    criteria.createAlias("questions", "questions");
    criteria.add(Restrictions.eq("questions.qid", questionId));
    return getHibernateTemplate().findByCriteria(criteria);

  }

View Full Code Here

   * .encuestame.persistence.domain.question.Question, java.lang.String)
   */
    @SuppressWarnings("unchecked")
  public List getQuestionPreference(final Question question, final String pref){
      final DetachedCriteria criteria = DetachedCriteria.forClass(QuestionPreferences.class);
      criteria.createAlias("question", "question");
      criteria.add(Restrictions.eq("question", question));
      //criteria.add(Restrictions.eq("preference", preference));
      criteria.add(Restrictions.like("preference", pref, MatchMode.ANYWHERE));
      return getHibernateTemplate().findByCriteria(criteria);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    List<Role> list = (List<Role>)getCache(CACHE_ROLE_LIST);
    if (list == null){
      User user = getUser();
      DetachedCriteria dc = roleDao.createDetachedCriteria();
      dc.createAlias("office", "office");
      dc.createAlias("userList", "userList", JoinType.LEFT_OUTER_JOIN);
      dc.add(dataScopeFilter(user, "office", "userList"));
      dc.add(Restrictions.eq(Role.FIELD_DEL_FLAG, Role.DEL_FLAG_NORMAL));
      dc.addOrder(Order.asc("office.code")).addOrder(Order.asc("name"));
      list = roleDao.find(dc);
View Full Code Here

    List<Role> list = (List<Role>)getCache(CACHE_ROLE_LIST);
    if (list == null){
      User user = getUser();
      DetachedCriteria dc = roleDao.createDetachedCriteria();
      dc.createAlias("office", "office");
      dc.createAlias("userList", "userList", JoinType.LEFT_OUTER_JOIN);
      dc.add(dataScopeFilter(user, "office", "userList"));
      dc.add(Restrictions.eq(Role.FIELD_DEL_FLAG, Role.DEL_FLAG_NORMAL));
      dc.addOrder(Order.asc("office.code")).addOrder(Order.asc("name"));
      list = roleDao.find(dc);
      putCache(CACHE_ROLE_LIST, list);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.