Package org.hibernate.criterion

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


        Map<String, String> subargs = childargs.get(type);
        logger.debug("child type {}", type);

        for (String key : subargs.keySet()) {
          DetachedCriteria propCriteria = subquery.createCriteria("properties");
          propCriteria
              .createAlias("type", "t")
              .add(Restrictions.eq("t.name", key))
              .createAlias("valuelist", "vl")
              .add(Restrictions.eq("nextRevision", Modification.MaxRevision))
              .createAlias("vl.values", "v")
View Full Code Here


     * @see org.encuestame.persistence.dao.IPoll#getPollsByPollFolderId(org.encuestame.persistence.domain.security.UserAccount, org.encuestame.persistence.domain.survey.PollFolder)
     */
    @SuppressWarnings("unchecked")
    public List getPollsByPollFolderId(final UserAccount userId, final PollFolder folder){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.createAlias("editorOwner", "editorOwner");
        //criteria.add(Restrictions.eq("editorOwner.uid", userId));
        criteria.add(Restrictions.eq("pollFolder", folder));
        return getHibernateTemplate().findByCriteria(criteria);
    }

View Full Code Here

     * @see org.encuestame.persistence.dao.IPoll#getMaxPollLikeVotesbyUser(java.lang.Long, java.util.Date, java.util.Date)
     */
    public Long getMaxPollLikeVotesbyUser(final Long userId, final Date dateFrom, final Date dateTo) {
        DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.setProjection(Projections.max("likeVote"));
        criteria.createAlias("editorOwner", "editorOwner");
        criteria.add(Restrictions.eq("editorOwner.uid", userId));
        criteria.add(Restrictions.between("createDate", dateFrom, dateTo));
        List results = getHibernateTemplate().findByCriteria(criteria);
        return (Long) (results.get(0) == null ? 0 : results.get(0));
    }
View Full Code Here

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

     * @see org.encuestame.persistence.dao.IPoll#getPollbyQuestion(java.lang.Long)
     */
    @SuppressWarnings("unchecked")
    public Poll getPollbyQuestion(final Long questionId){
        final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.createAlias("question", "question");
        criteria.add(Restrictions.eq("question.qid", questionId));
        return (Poll) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
    }

    /**
 
View Full Code Here

     * @see org.encuestame.persistence.dao.IPoll#retrievePollByDate(org.encuestame.utils.web.search.PollSearchBean, java.lang.Long, java.util.Date)
     */
    @SuppressWarnings("unchecked")
    public List<Poll> retrievePollByDate(final PollSearchBean bean, final Long userId, final Date initDate) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.createAlias("owner", "owner");
        criteria.add(Restrictions.eq("owner.id", userId));
        criteria.add(Restrictions.between("createDate", initDate,
                getNextDayMidnightDate()));
        return useAvancedSearch(criteria, bean);
    }
View Full Code Here

     * @see org.encuestame.persistence.dao.IPoll#retrieveFavouritesPoll(org.encuestame.utils.web.search.PollSearchBean, java.lang.Long)
     */
    @SuppressWarnings("unchecked")
    public List<Poll> retrieveFavouritesPoll(final PollSearchBean bean, final Long userId) {
        final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
        criteria.createAlias("owner", "owner");
        criteria.add(Restrictions.eq("owner.uid", userId));
        return useAvancedSearch(criteria, bean);
    }

    /*
 
View Full Code Here

     * @see org.encuestame.persistence.dao.IPoll#retrieveScheduledPoll(org.encuestame.utils.web.search.PollSearchBean, java.lang.Long)
     */
   @SuppressWarnings("unchecked")
   public List<Poll> retrieveScheduledPoll(final PollSearchBean bean, final Long userId) {
       final DetachedCriteria criteria = DetachedCriteria.forClass(Poll.class);
       criteria.createAlias("owner", "owner");
       criteria.add(Restrictions.eq("owner.uid", userId));
       // To retrieve all and only scheduled Tweetpoll period should be = ALLTIME
       return useAvancedSearch(criteria, bean);
   }

View Full Code Here

            final Boolean isCompleted, final Boolean isScheduled,
            final Boolean isPublished, final Boolean isFavourite,
            final String period) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        // removed because is the advancedSearchOptions should inject this value
        // criteria.add(Restrictions.eq("publishTweetPoll", Boolean.TRUE));
        criteria.add(Restrictions.eq("tweetOwner.id", userId));
        criteria.addOrder(Order.desc("createDate"));
        advancedTweetPollSearchOptions(criteria, isCompleted, isScheduled, isFavourite, isPublished, keyWord, period);
View Full Code Here

            final Long userId, final Integer maxResults, final Integer start,
            final Boolean isCompleted, final Boolean isScheduled,
            final Boolean isFavourite, final Boolean isPublished, final String period) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("tweetOwner.id", userId));
        advancedTweetPollSearchOptions(criteria, isCompleted, isScheduled, isFavourite, isPublished, keyWord, period);
        return (List<TweetPoll>) filterByMaxorStart(criteria, maxResults, start);
    }
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.