Created
January 23, 2012 22:16
-
-
Save edalquist/1665818 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected CriteriaQuery<LoginAggregationImpl> buildFindLoginAggregationsByDateRangeQuery(final CriteriaBuilder cb) { | |
| final CriteriaQuery<LoginAggregationImpl> criteriaQuery = cb.createQuery(LoginAggregationImpl.class); | |
| final Root<DateDimensionImpl> root = criteriaQuery.from(DateDimensionImpl.class); | |
| final CollectionJoin<DateDimensionImpl, LoginAggregationImpl> loginAggrJoin = root.join(DateDimensionImpl_.loginAggregations, JoinType.LEFT); | |
| criteriaQuery.select(loginAggrJoin); | |
| criteriaQuery.where( | |
| cb.and( | |
| cb.between(root.get(DateDimensionImpl_.date), this.startDate, this.endDate), | |
| cb.equal(loginAggrJoin.get(LoginAggregationImpl_.interval), this.intervalParameter), | |
| cb.equal(loginAggrJoin.get(LoginAggregationImpl_.aggregatedGroup), this.aggregatedGroupParameter) | |
| ) | |
| ); | |
| criteriaQuery.orderBy(cb.desc(root.get(DateDimensionImpl_.date))); | |
| return criteriaQuery; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment