Package org.hibernate.criterion

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


      final TypeSearchResult itemType, final CommentOptions commentOptions, final SearchPeriods period) {
    final DetachedCriteria criteria = DetachedCriteria
        .forClass(Comment.class);
    criteria.setProjection(Projections.rowCount());
    if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
      criteria.createAlias("tweetPoll", "tweetPoll");
      criteria.add(Restrictions.isNotNull("tweetPoll"));
    } else if (itemType.equals(TypeSearchResult.POLL)) {
      criteria.createAlias("poll", "poll");
      criteria.add(Restrictions.isNotNull("poll"));
    } else if (itemType.equals(TypeSearchResult.SURVEY)) {
View Full Code Here


    criteria.setProjection(Projections.rowCount());
    if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
      criteria.createAlias("tweetPoll", "tweetPoll");
      criteria.add(Restrictions.isNotNull("tweetPoll"));
    } else if (itemType.equals(TypeSearchResult.POLL)) {
      criteria.createAlias("poll", "poll");
      criteria.add(Restrictions.isNotNull("poll"));
    } else if (itemType.equals(TypeSearchResult.SURVEY)) {
      criteria.createAlias("survey", "survey");
      criteria.add(Restrictions.isNotNull("survey"));
    } else {
View Full Code Here

      criteria.add(Restrictions.isNotNull("tweetPoll"));
    } else if (itemType.equals(TypeSearchResult.POLL)) {
      criteria.createAlias("poll", "poll");
      criteria.add(Restrictions.isNotNull("poll"));
    } else if (itemType.equals(TypeSearchResult.SURVEY)) {
      criteria.createAlias("survey", "survey");
      criteria.add(Restrictions.isNotNull("survey"));
    } else {
      log.error(" Search result type undefined " + itemType);
    }
    if (!commentOptions.equals(CommentOptions.ALL)) {
View Full Code Here

     * @return
     */
    @SuppressWarnings("unchecked")
    public SocialAccount getAccountConnection(final String accountId, final SocialProvider provider){
        final DetachedCriteria criteria = DetachedCriteria.forClass(SocialAccount.class);
        criteria.createAlias("userAccout","userAccout");
        criteria.add(Restrictions.eq("userAccout.uid", accountId));
        criteria.add(Restrictions.eq("accounType", provider));
        return (SocialAccount) DataAccessUtils.uniqueResult(getHibernateTemplate()
                .findByCriteria(criteria));
    }
View Full Code Here

     * @return
     */
    @SuppressWarnings("unchecked")
    public Group getGroupByIdandUser(final Long groupId, final Long userId){
         final DetachedCriteria criteria = DetachedCriteria.forClass(Group.class);
         criteria.createAlias("account", "account");
         criteria.add(Restrictions.eq("account.uid", userId));
         criteria.add(Restrictions.eq("tweetPollId", groupId));
         return (Group) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
    }

View Full Code Here

            final SearchPeriods period,
            final Integer start,
            final Integer maxResults,
            final Integer firstResult) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(TweetPoll.class);
        criteria.createAlias("question", "question");
        calculateSearchPeriodsDates(period, criteria, "createDate");
        criteria.add(Restrictions.eq("publishTweetPoll", Boolean.TRUE)); //should be published
        criteria.add(Restrictions.gt("relevance", 0L));
        criteria.addOrder(Order.desc("relevance"));
        criteria.addOrder(Order.desc("createDate"));
View Full Code Here

            final SearchPeriods period,
            final Integer start,
            final Integer maxResults,
            final Integer firstResult) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.createAlias("question", "question");
        calculateSearchPeriodsDates(period, criteria, "createDate");
        criteria.add(Restrictions.gt("relevance", 0L));
        criteria.addOrder(Order.desc("relevance"));
        criteria.add(Restrictions.eq("publish", Boolean.TRUE)); //should be published
        criteria.addOrder(Order.desc("createDate"));
View Full Code Here

    public List getAllHitsByType(final TweetPoll tweetpoll,
            final Poll poll,
            final Survey survey) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(Hit.class);
        if (poll != null) {
            criteria.createAlias("poll", "poll");
            criteria.add(Restrictions.eq("poll", poll));
        } else if (tweetpoll != null) {
            criteria.createAlias("tweetPoll", "tweetPoll");
            criteria.add(Restrictions.eq("tweetPoll", tweetpoll));
        } else if (survey != null) {
View Full Code Here

        final DetachedCriteria criteria = DetachedCriteria.forClass(Hit.class);
        if (poll != null) {
            criteria.createAlias("poll", "poll");
            criteria.add(Restrictions.eq("poll", poll));
        } else if (tweetpoll != null) {
            criteria.createAlias("tweetPoll", "tweetPoll");
            criteria.add(Restrictions.eq("tweetPoll", tweetpoll));
        } else if (survey != null) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey", survey));
        }
View Full Code Here

            criteria.add(Restrictions.eq("poll", poll));
        } else if (tweetpoll != null) {
            criteria.createAlias("tweetPoll", "tweetPoll");
            criteria.add(Restrictions.eq("tweetPoll", tweetpoll));
        } else if (survey != null) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey", survey));
        }
        return getHibernateTemplate().findByCriteria(criteria);
    }
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.