Package org.hibernate.criterion

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


             startDate = DateUtil.minusDaysToCurrentDate(period, dateTime.toDate());
         }
        final DetachedCriteria criteria = DetachedCriteria.forClass(Hit.class);
        criteria.setProjection(Projections.rowCount());
        if (searchHitby.equals(TypeSearchResult.TWEETPOLL)) {
            criteria.createAlias("tweetPoll", "tweetPoll");
            criteria.add(Restrictions.eq("tweetPoll.tweetPollId", id));
        } else if (searchHitby.equals(TypeSearchResult.POLL)) {
            criteria.createAlias("poll", "poll");
            criteria.add(Restrictions.eq("poll.pollId", id));
        } else if (searchHitby.equals(TypeSearchResult.SURVEY)) {
View Full Code Here


        criteria.setProjection(Projections.rowCount());
        if (searchHitby.equals(TypeSearchResult.TWEETPOLL)) {
            criteria.createAlias("tweetPoll", "tweetPoll");
            criteria.add(Restrictions.eq("tweetPoll.tweetPollId", id));
        } else if (searchHitby.equals(TypeSearchResult.POLL)) {
            criteria.createAlias("poll", "poll");
            criteria.add(Restrictions.eq("poll.pollId", id));
        } else if (searchHitby.equals(TypeSearchResult.SURVEY)) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey.sid", id));
        } else if (searchHitby.equals(TypeSearchResult.HASHTAG)) {
View Full Code Here

    //TODO: migrate search to Hibernate Search.
    public List<Survey> retrieveSurveybyName(final String keyWord, final Long userId,
            final Integer maxResults,
            final Integer start){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
        criteria.createAlias("editorOwner","editorOwner");
        criteria.add(Restrictions.like("name", keyWord, MatchMode.ANYWHERE));
        criteria.add(Restrictions.eq("editorOwner.uid", userId));
        return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

            final Account account,
            final Date initDate,
            final Integer maxResults,
            final Integer start){
         final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
         criteria.createAlias("owner","owner");
         criteria.add(Restrictions.between("createDate", initDate, getNextDayMidnightDate()));
         criteria.add(Restrictions.eq("owner", account));
         return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    public List<Survey> retrieveFavoritesSurvey(
            final UserAccount userAccount,
            final Integer maxResults,
            final Integer start){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
        criteria.createAlias("editorOwner","editorOwner");
        criteria.add(Restrictions.eq("editorOwner", userAccount));
        criteria.add(Restrictions.eq("favourites", Boolean.TRUE));
        return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    public List<Survey> retrieveScheduledSurvey(
            final Long userId,
            final Integer maxResults,
            final Integer start){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
        criteria.createAlias("editorOwner","editorOwner");
        criteria.add(Restrictions.eq("scheduleSurvey", Boolean.TRUE));
        criteria.add(Restrictions.isNotNull("scheduleDate"));
        criteria.add(Restrictions.eq("editorOwner.uid", userId));
        return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    public List<Survey> retrieveSurveyByUserId(
            final Long userId,
            final Integer maxResults,
            final Integer start){
         final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
         criteria.createAlias("editorOwner","editorOwner");
         criteria.add(Restrictions.eq("editorOwner.uid", userId));
         criteria.addOrder(Order.desc("createDate"));
         return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    public List<Survey> retrieveSurveyByAccount(
            final Long userId,
            final Integer maxResults,
            final Integer start){
         final DetachedCriteria criteria = DetachedCriteria.forClass(Survey.class);
         criteria.createAlias("owner","owner");
         criteria.add(Restrictions.eq("owner.uid", userId));
         criteria.addOrder(Order.desc("createDate"));
         return (List<Survey>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

            criteria.add(Restrictions.eq("tweetPoll.tweetPollId", id));
        } else if (searchHitby.equals(TypeSearchResult.POLL)) {
            criteria.createAlias("poll", "poll");
            criteria.add(Restrictions.eq("poll.pollId", id));
        } else if (searchHitby.equals(TypeSearchResult.SURVEY)) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey.sid", id));
        } else if (searchHitby.equals(TypeSearchResult.HASHTAG)) {
            criteria.createAlias("hashTag", "hashTag");
            criteria.add(Restrictions.eq("hashTag.hashTagId", id));
        } else {
View Full Code Here

            criteria.add(Restrictions.eq("poll.pollId", id));
        } else if (searchHitby.equals(TypeSearchResult.SURVEY)) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey.sid", id));
        } else if (searchHitby.equals(TypeSearchResult.HASHTAG)) {
            criteria.createAlias("hashTag", "hashTag");
            criteria.add(Restrictions.eq("hashTag.hashTagId", id));
        } else {
            log.error(" Search hit result type undefined " + searchHitby);
        }
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.