001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.blogs.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.Session;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.CalendarUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.service.persistence.BatchSessionUtil;
039    import com.liferay.portal.service.persistence.GroupPersistence;
040    import com.liferay.portal.service.persistence.ResourcePersistence;
041    import com.liferay.portal.service.persistence.UserPersistence;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import com.liferay.portlet.blogs.NoSuchStatsUserException;
045    import com.liferay.portlet.blogs.model.BlogsStatsUser;
046    import com.liferay.portlet.blogs.model.impl.BlogsStatsUserImpl;
047    import com.liferay.portlet.blogs.model.impl.BlogsStatsUserModelImpl;
048    
049    import java.io.Serializable;
050    
051    import java.util.ArrayList;
052    import java.util.Collections;
053    import java.util.Date;
054    import java.util.List;
055    
056    /**
057     * The persistence implementation for the blogs stats user service.
058     *
059     * <p>
060     * Never modify or reference this class directly. Always use {@link BlogsStatsUserUtil} to access the blogs stats user persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
061     * </p>
062     *
063     * <p>
064     * Caching information and settings can be found in <code>portal.properties</code>
065     * </p>
066     *
067     * @author Brian Wing Shun Chan
068     * @see BlogsStatsUserPersistence
069     * @see BlogsStatsUserUtil
070     * @generated
071     */
072    public class BlogsStatsUserPersistenceImpl extends BasePersistenceImpl<BlogsStatsUser>
073            implements BlogsStatsUserPersistence {
074            public static final String FINDER_CLASS_NAME_ENTITY = BlogsStatsUserImpl.class.getName();
075            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
076                    ".List";
077            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
078                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
079                            FINDER_CLASS_NAME_LIST, "findByGroupId",
080                            new String[] {
081                                    Long.class.getName(),
082                                    
083                            "java.lang.Integer", "java.lang.Integer",
084                                    "com.liferay.portal.kernel.util.OrderByComparator"
085                            });
086            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
087                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
088                            FINDER_CLASS_NAME_LIST, "countByGroupId",
089                            new String[] { Long.class.getName() });
090            public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
091                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
092                            FINDER_CLASS_NAME_LIST, "findByUserId",
093                            new String[] {
094                                    Long.class.getName(),
095                                    
096                            "java.lang.Integer", "java.lang.Integer",
097                                    "com.liferay.portal.kernel.util.OrderByComparator"
098                            });
099            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
100                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
101                            FINDER_CLASS_NAME_LIST, "countByUserId",
102                            new String[] { Long.class.getName() });
103            public static final FinderPath FINDER_PATH_FETCH_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
104                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
105                            FINDER_CLASS_NAME_ENTITY, "fetchByG_U",
106                            new String[] { Long.class.getName(), Long.class.getName() });
107            public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
108                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
109                            FINDER_CLASS_NAME_LIST, "countByG_U",
110                            new String[] { Long.class.getName(), Long.class.getName() });
111            public static final FinderPath FINDER_PATH_FIND_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
112                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
113                            FINDER_CLASS_NAME_LIST, "findByG_NotE",
114                            new String[] {
115                                    Long.class.getName(), Integer.class.getName(),
116                                    
117                            "java.lang.Integer", "java.lang.Integer",
118                                    "com.liferay.portal.kernel.util.OrderByComparator"
119                            });
120            public static final FinderPath FINDER_PATH_COUNT_BY_G_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
121                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
122                            FINDER_CLASS_NAME_LIST, "countByG_NotE",
123                            new String[] { Long.class.getName(), Integer.class.getName() });
124            public static final FinderPath FINDER_PATH_FIND_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
125                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
126                            FINDER_CLASS_NAME_LIST, "findByC_NotE",
127                            new String[] {
128                                    Long.class.getName(), Integer.class.getName(),
129                                    
130                            "java.lang.Integer", "java.lang.Integer",
131                                    "com.liferay.portal.kernel.util.OrderByComparator"
132                            });
133            public static final FinderPath FINDER_PATH_COUNT_BY_C_NOTE = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
134                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
135                            FINDER_CLASS_NAME_LIST, "countByC_NotE",
136                            new String[] { Long.class.getName(), Integer.class.getName() });
137            public static final FinderPath FINDER_PATH_FIND_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
138                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
139                            FINDER_CLASS_NAME_LIST, "findByU_L",
140                            new String[] {
141                                    Long.class.getName(), Date.class.getName(),
142                                    
143                            "java.lang.Integer", "java.lang.Integer",
144                                    "com.liferay.portal.kernel.util.OrderByComparator"
145                            });
146            public static final FinderPath FINDER_PATH_COUNT_BY_U_L = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
147                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
148                            FINDER_CLASS_NAME_LIST, "countByU_L",
149                            new String[] { Long.class.getName(), Date.class.getName() });
150            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
151                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
152                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
153            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
154                            BlogsStatsUserModelImpl.FINDER_CACHE_ENABLED,
155                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
156    
157            /**
158             * Caches the blogs stats user in the entity cache if it is enabled.
159             *
160             * @param blogsStatsUser the blogs stats user to cache
161             */
162            public void cacheResult(BlogsStatsUser blogsStatsUser) {
163                    EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
164                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
165                            blogsStatsUser);
166    
167                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
168                            new Object[] {
169                                    new Long(blogsStatsUser.getGroupId()),
170                                    new Long(blogsStatsUser.getUserId())
171                            }, blogsStatsUser);
172            }
173    
174            /**
175             * Caches the blogs stats users in the entity cache if it is enabled.
176             *
177             * @param blogsStatsUsers the blogs stats users to cache
178             */
179            public void cacheResult(List<BlogsStatsUser> blogsStatsUsers) {
180                    for (BlogsStatsUser blogsStatsUser : blogsStatsUsers) {
181                            if (EntityCacheUtil.getResult(
182                                                    BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
183                                                    BlogsStatsUserImpl.class,
184                                                    blogsStatsUser.getPrimaryKey(), this) == null) {
185                                    cacheResult(blogsStatsUser);
186                            }
187                    }
188            }
189    
190            /**
191             * Clears the cache for all blogs stats users.
192             *
193             * <p>
194             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
195             * </p>
196             */
197            public void clearCache() {
198                    CacheRegistryUtil.clear(BlogsStatsUserImpl.class.getName());
199                    EntityCacheUtil.clearCache(BlogsStatsUserImpl.class.getName());
200                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
201                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
202            }
203    
204            /**
205             * Clears the cache for the blogs stats user.
206             *
207             * <p>
208             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
209             * </p>
210             */
211            public void clearCache(BlogsStatsUser blogsStatsUser) {
212                    EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
213                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
214    
215                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
216                            new Object[] {
217                                    new Long(blogsStatsUser.getGroupId()),
218                                    new Long(blogsStatsUser.getUserId())
219                            });
220            }
221    
222            /**
223             * Creates a new blogs stats user with the primary key. Does not add the blogs stats user to the database.
224             *
225             * @param statsUserId the primary key for the new blogs stats user
226             * @return the new blogs stats user
227             */
228            public BlogsStatsUser create(long statsUserId) {
229                    BlogsStatsUser blogsStatsUser = new BlogsStatsUserImpl();
230    
231                    blogsStatsUser.setNew(true);
232                    blogsStatsUser.setPrimaryKey(statsUserId);
233    
234                    return blogsStatsUser;
235            }
236    
237            /**
238             * Removes the blogs stats user with the primary key from the database. Also notifies the appropriate model listeners.
239             *
240             * @param primaryKey the primary key of the blogs stats user to remove
241             * @return the blogs stats user that was removed
242             * @throws com.liferay.portal.NoSuchModelException if a blogs stats user with the primary key could not be found
243             * @throws SystemException if a system exception occurred
244             */
245            public BlogsStatsUser remove(Serializable primaryKey)
246                    throws NoSuchModelException, SystemException {
247                    return remove(((Long)primaryKey).longValue());
248            }
249    
250            /**
251             * Removes the blogs stats user with the primary key from the database. Also notifies the appropriate model listeners.
252             *
253             * @param statsUserId the primary key of the blogs stats user to remove
254             * @return the blogs stats user that was removed
255             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
256             * @throws SystemException if a system exception occurred
257             */
258            public BlogsStatsUser remove(long statsUserId)
259                    throws NoSuchStatsUserException, SystemException {
260                    Session session = null;
261    
262                    try {
263                            session = openSession();
264    
265                            BlogsStatsUser blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
266                                            new Long(statsUserId));
267    
268                            if (blogsStatsUser == null) {
269                                    if (_log.isWarnEnabled()) {
270                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsUserId);
271                                    }
272    
273                                    throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
274                                            statsUserId);
275                            }
276    
277                            return remove(blogsStatsUser);
278                    }
279                    catch (NoSuchStatsUserException nsee) {
280                            throw nsee;
281                    }
282                    catch (Exception e) {
283                            throw processException(e);
284                    }
285                    finally {
286                            closeSession(session);
287                    }
288            }
289    
290            protected BlogsStatsUser removeImpl(BlogsStatsUser blogsStatsUser)
291                    throws SystemException {
292                    blogsStatsUser = toUnwrappedModel(blogsStatsUser);
293    
294                    Session session = null;
295    
296                    try {
297                            session = openSession();
298    
299                            BatchSessionUtil.delete(session, blogsStatsUser);
300                    }
301                    catch (Exception e) {
302                            throw processException(e);
303                    }
304                    finally {
305                            closeSession(session);
306                    }
307    
308                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
309    
310                    BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
311    
312                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
313                            new Object[] {
314                                    new Long(blogsStatsUserModelImpl.getOriginalGroupId()),
315                                    new Long(blogsStatsUserModelImpl.getOriginalUserId())
316                            });
317    
318                    EntityCacheUtil.removeResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
319                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey());
320    
321                    return blogsStatsUser;
322            }
323    
324            public BlogsStatsUser updateImpl(
325                    com.liferay.portlet.blogs.model.BlogsStatsUser blogsStatsUser,
326                    boolean merge) throws SystemException {
327                    blogsStatsUser = toUnwrappedModel(blogsStatsUser);
328    
329                    boolean isNew = blogsStatsUser.isNew();
330    
331                    BlogsStatsUserModelImpl blogsStatsUserModelImpl = (BlogsStatsUserModelImpl)blogsStatsUser;
332    
333                    Session session = null;
334    
335                    try {
336                            session = openSession();
337    
338                            BatchSessionUtil.update(session, blogsStatsUser, merge);
339    
340                            blogsStatsUser.setNew(false);
341                    }
342                    catch (Exception e) {
343                            throw processException(e);
344                    }
345                    finally {
346                            closeSession(session);
347                    }
348    
349                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
350    
351                    EntityCacheUtil.putResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
352                            BlogsStatsUserImpl.class, blogsStatsUser.getPrimaryKey(),
353                            blogsStatsUser);
354    
355                    if (!isNew &&
356                                    ((blogsStatsUser.getGroupId() != blogsStatsUserModelImpl.getOriginalGroupId()) ||
357                                    (blogsStatsUser.getUserId() != blogsStatsUserModelImpl.getOriginalUserId()))) {
358                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_U,
359                                    new Object[] {
360                                            new Long(blogsStatsUserModelImpl.getOriginalGroupId()),
361                                            new Long(blogsStatsUserModelImpl.getOriginalUserId())
362                                    });
363                    }
364    
365                    if (isNew ||
366                                    ((blogsStatsUser.getGroupId() != blogsStatsUserModelImpl.getOriginalGroupId()) ||
367                                    (blogsStatsUser.getUserId() != blogsStatsUserModelImpl.getOriginalUserId()))) {
368                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
369                                    new Object[] {
370                                            new Long(blogsStatsUser.getGroupId()),
371                                            new Long(blogsStatsUser.getUserId())
372                                    }, blogsStatsUser);
373                    }
374    
375                    return blogsStatsUser;
376            }
377    
378            protected BlogsStatsUser toUnwrappedModel(BlogsStatsUser blogsStatsUser) {
379                    if (blogsStatsUser instanceof BlogsStatsUserImpl) {
380                            return blogsStatsUser;
381                    }
382    
383                    BlogsStatsUserImpl blogsStatsUserImpl = new BlogsStatsUserImpl();
384    
385                    blogsStatsUserImpl.setNew(blogsStatsUser.isNew());
386                    blogsStatsUserImpl.setPrimaryKey(blogsStatsUser.getPrimaryKey());
387    
388                    blogsStatsUserImpl.setStatsUserId(blogsStatsUser.getStatsUserId());
389                    blogsStatsUserImpl.setGroupId(blogsStatsUser.getGroupId());
390                    blogsStatsUserImpl.setCompanyId(blogsStatsUser.getCompanyId());
391                    blogsStatsUserImpl.setUserId(blogsStatsUser.getUserId());
392                    blogsStatsUserImpl.setEntryCount(blogsStatsUser.getEntryCount());
393                    blogsStatsUserImpl.setLastPostDate(blogsStatsUser.getLastPostDate());
394                    blogsStatsUserImpl.setRatingsTotalEntries(blogsStatsUser.getRatingsTotalEntries());
395                    blogsStatsUserImpl.setRatingsTotalScore(blogsStatsUser.getRatingsTotalScore());
396                    blogsStatsUserImpl.setRatingsAverageScore(blogsStatsUser.getRatingsAverageScore());
397    
398                    return blogsStatsUserImpl;
399            }
400    
401            /**
402             * Finds the blogs stats user with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
403             *
404             * @param primaryKey the primary key of the blogs stats user to find
405             * @return the blogs stats user
406             * @throws com.liferay.portal.NoSuchModelException if a blogs stats user with the primary key could not be found
407             * @throws SystemException if a system exception occurred
408             */
409            public BlogsStatsUser findByPrimaryKey(Serializable primaryKey)
410                    throws NoSuchModelException, SystemException {
411                    return findByPrimaryKey(((Long)primaryKey).longValue());
412            }
413    
414            /**
415             * Finds the blogs stats user with the primary key or throws a {@link com.liferay.portlet.blogs.NoSuchStatsUserException} if it could not be found.
416             *
417             * @param statsUserId the primary key of the blogs stats user to find
418             * @return the blogs stats user
419             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
420             * @throws SystemException if a system exception occurred
421             */
422            public BlogsStatsUser findByPrimaryKey(long statsUserId)
423                    throws NoSuchStatsUserException, SystemException {
424                    BlogsStatsUser blogsStatsUser = fetchByPrimaryKey(statsUserId);
425    
426                    if (blogsStatsUser == null) {
427                            if (_log.isWarnEnabled()) {
428                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + statsUserId);
429                            }
430    
431                            throw new NoSuchStatsUserException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
432                                    statsUserId);
433                    }
434    
435                    return blogsStatsUser;
436            }
437    
438            /**
439             * Finds the blogs stats user with the primary key or returns <code>null</code> if it could not be found.
440             *
441             * @param primaryKey the primary key of the blogs stats user to find
442             * @return the blogs stats user, or <code>null</code> if a blogs stats user with the primary key could not be found
443             * @throws SystemException if a system exception occurred
444             */
445            public BlogsStatsUser fetchByPrimaryKey(Serializable primaryKey)
446                    throws SystemException {
447                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
448            }
449    
450            /**
451             * Finds the blogs stats user with the primary key or returns <code>null</code> if it could not be found.
452             *
453             * @param statsUserId the primary key of the blogs stats user to find
454             * @return the blogs stats user, or <code>null</code> if a blogs stats user with the primary key could not be found
455             * @throws SystemException if a system exception occurred
456             */
457            public BlogsStatsUser fetchByPrimaryKey(long statsUserId)
458                    throws SystemException {
459                    BlogsStatsUser blogsStatsUser = (BlogsStatsUser)EntityCacheUtil.getResult(BlogsStatsUserModelImpl.ENTITY_CACHE_ENABLED,
460                                    BlogsStatsUserImpl.class, statsUserId, this);
461    
462                    if (blogsStatsUser == null) {
463                            Session session = null;
464    
465                            try {
466                                    session = openSession();
467    
468                                    blogsStatsUser = (BlogsStatsUser)session.get(BlogsStatsUserImpl.class,
469                                                    new Long(statsUserId));
470                            }
471                            catch (Exception e) {
472                                    throw processException(e);
473                            }
474                            finally {
475                                    if (blogsStatsUser != null) {
476                                            cacheResult(blogsStatsUser);
477                                    }
478    
479                                    closeSession(session);
480                            }
481                    }
482    
483                    return blogsStatsUser;
484            }
485    
486            /**
487             * Finds all the blogs stats users where groupId = &#63;.
488             *
489             * @param groupId the group id to search with
490             * @return the matching blogs stats users
491             * @throws SystemException if a system exception occurred
492             */
493            public List<BlogsStatsUser> findByGroupId(long groupId)
494                    throws SystemException {
495                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
496            }
497    
498            /**
499             * Finds a range of all the blogs stats users where groupId = &#63;.
500             *
501             * <p>
502             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
503             * </p>
504             *
505             * @param groupId the group id to search with
506             * @param start the lower bound of the range of blogs stats users to return
507             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
508             * @return the range of matching blogs stats users
509             * @throws SystemException if a system exception occurred
510             */
511            public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end)
512                    throws SystemException {
513                    return findByGroupId(groupId, start, end, null);
514            }
515    
516            /**
517             * Finds an ordered range of all the blogs stats users where groupId = &#63;.
518             *
519             * <p>
520             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
521             * </p>
522             *
523             * @param groupId the group id to search with
524             * @param start the lower bound of the range of blogs stats users to return
525             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
526             * @param orderByComparator the comparator to order the results by
527             * @return the ordered range of matching blogs stats users
528             * @throws SystemException if a system exception occurred
529             */
530            public List<BlogsStatsUser> findByGroupId(long groupId, int start, int end,
531                    OrderByComparator orderByComparator) throws SystemException {
532                    Object[] finderArgs = new Object[] {
533                                    groupId,
534                                    
535                                    String.valueOf(start), String.valueOf(end),
536                                    String.valueOf(orderByComparator)
537                            };
538    
539                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
540                                    finderArgs, this);
541    
542                    if (list == null) {
543                            Session session = null;
544    
545                            try {
546                                    session = openSession();
547    
548                                    StringBundler query = null;
549    
550                                    if (orderByComparator != null) {
551                                            query = new StringBundler(3 +
552                                                            (orderByComparator.getOrderByFields().length * 3));
553                                    }
554                                    else {
555                                            query = new StringBundler(3);
556                                    }
557    
558                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
559    
560                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
561    
562                                    if (orderByComparator != null) {
563                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
564                                                    orderByComparator);
565                                    }
566    
567                                    else {
568                                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
569                                    }
570    
571                                    String sql = query.toString();
572    
573                                    Query q = session.createQuery(sql);
574    
575                                    QueryPos qPos = QueryPos.getInstance(q);
576    
577                                    qPos.add(groupId);
578    
579                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
580                                                    start, end);
581                            }
582                            catch (Exception e) {
583                                    throw processException(e);
584                            }
585                            finally {
586                                    if (list == null) {
587                                            list = new ArrayList<BlogsStatsUser>();
588                                    }
589    
590                                    cacheResult(list);
591    
592                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
593                                            finderArgs, list);
594    
595                                    closeSession(session);
596                            }
597                    }
598    
599                    return list;
600            }
601    
602            /**
603             * Finds the first blogs stats user in the ordered set where groupId = &#63;.
604             *
605             * <p>
606             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
607             * </p>
608             *
609             * @param groupId the group id to search with
610             * @param orderByComparator the comparator to order the set by
611             * @return the first matching blogs stats user
612             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
613             * @throws SystemException if a system exception occurred
614             */
615            public BlogsStatsUser findByGroupId_First(long groupId,
616                    OrderByComparator orderByComparator)
617                    throws NoSuchStatsUserException, SystemException {
618                    List<BlogsStatsUser> list = findByGroupId(groupId, 0, 1,
619                                    orderByComparator);
620    
621                    if (list.isEmpty()) {
622                            StringBundler msg = new StringBundler(4);
623    
624                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
625    
626                            msg.append("groupId=");
627                            msg.append(groupId);
628    
629                            msg.append(StringPool.CLOSE_CURLY_BRACE);
630    
631                            throw new NoSuchStatsUserException(msg.toString());
632                    }
633                    else {
634                            return list.get(0);
635                    }
636            }
637    
638            /**
639             * Finds the last blogs stats user in the ordered set where groupId = &#63;.
640             *
641             * <p>
642             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
643             * </p>
644             *
645             * @param groupId the group id to search with
646             * @param orderByComparator the comparator to order the set by
647             * @return the last matching blogs stats user
648             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
649             * @throws SystemException if a system exception occurred
650             */
651            public BlogsStatsUser findByGroupId_Last(long groupId,
652                    OrderByComparator orderByComparator)
653                    throws NoSuchStatsUserException, SystemException {
654                    int count = countByGroupId(groupId);
655    
656                    List<BlogsStatsUser> list = findByGroupId(groupId, count - 1, count,
657                                    orderByComparator);
658    
659                    if (list.isEmpty()) {
660                            StringBundler msg = new StringBundler(4);
661    
662                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
663    
664                            msg.append("groupId=");
665                            msg.append(groupId);
666    
667                            msg.append(StringPool.CLOSE_CURLY_BRACE);
668    
669                            throw new NoSuchStatsUserException(msg.toString());
670                    }
671                    else {
672                            return list.get(0);
673                    }
674            }
675    
676            /**
677             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where groupId = &#63;.
678             *
679             * <p>
680             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
681             * </p>
682             *
683             * @param statsUserId the primary key of the current blogs stats user
684             * @param groupId the group id to search with
685             * @param orderByComparator the comparator to order the set by
686             * @return the previous, current, and next blogs stats user
687             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
688             * @throws SystemException if a system exception occurred
689             */
690            public BlogsStatsUser[] findByGroupId_PrevAndNext(long statsUserId,
691                    long groupId, OrderByComparator orderByComparator)
692                    throws NoSuchStatsUserException, SystemException {
693                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
694    
695                    Session session = null;
696    
697                    try {
698                            session = openSession();
699    
700                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
701    
702                            array[0] = getByGroupId_PrevAndNext(session, blogsStatsUser,
703                                            groupId, orderByComparator, true);
704    
705                            array[1] = blogsStatsUser;
706    
707                            array[2] = getByGroupId_PrevAndNext(session, blogsStatsUser,
708                                            groupId, orderByComparator, false);
709    
710                            return array;
711                    }
712                    catch (Exception e) {
713                            throw processException(e);
714                    }
715                    finally {
716                            closeSession(session);
717                    }
718            }
719    
720            protected BlogsStatsUser getByGroupId_PrevAndNext(Session session,
721                    BlogsStatsUser blogsStatsUser, long groupId,
722                    OrderByComparator orderByComparator, boolean previous) {
723                    StringBundler query = null;
724    
725                    if (orderByComparator != null) {
726                            query = new StringBundler(6 +
727                                            (orderByComparator.getOrderByFields().length * 6));
728                    }
729                    else {
730                            query = new StringBundler(3);
731                    }
732    
733                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
734    
735                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
736    
737                    if (orderByComparator != null) {
738                            String[] orderByFields = orderByComparator.getOrderByFields();
739    
740                            if (orderByFields.length > 0) {
741                                    query.append(WHERE_AND);
742                            }
743    
744                            for (int i = 0; i < orderByFields.length; i++) {
745                                    query.append(_ORDER_BY_ENTITY_ALIAS);
746                                    query.append(orderByFields[i]);
747    
748                                    if ((i + 1) < orderByFields.length) {
749                                            if (orderByComparator.isAscending() ^ previous) {
750                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
751                                            }
752                                            else {
753                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
754                                            }
755                                    }
756                                    else {
757                                            if (orderByComparator.isAscending() ^ previous) {
758                                                    query.append(WHERE_GREATER_THAN);
759                                            }
760                                            else {
761                                                    query.append(WHERE_LESSER_THAN);
762                                            }
763                                    }
764                            }
765    
766                            query.append(ORDER_BY_CLAUSE);
767    
768                            for (int i = 0; i < orderByFields.length; i++) {
769                                    query.append(_ORDER_BY_ENTITY_ALIAS);
770                                    query.append(orderByFields[i]);
771    
772                                    if ((i + 1) < orderByFields.length) {
773                                            if (orderByComparator.isAscending() ^ previous) {
774                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
775                                            }
776                                            else {
777                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
778                                            }
779                                    }
780                                    else {
781                                            if (orderByComparator.isAscending() ^ previous) {
782                                                    query.append(ORDER_BY_ASC);
783                                            }
784                                            else {
785                                                    query.append(ORDER_BY_DESC);
786                                            }
787                                    }
788                            }
789                    }
790    
791                    else {
792                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
793                    }
794    
795                    String sql = query.toString();
796    
797                    Query q = session.createQuery(sql);
798    
799                    q.setFirstResult(0);
800                    q.setMaxResults(2);
801    
802                    QueryPos qPos = QueryPos.getInstance(q);
803    
804                    qPos.add(groupId);
805    
806                    if (orderByComparator != null) {
807                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
808    
809                            for (Object value : values) {
810                                    qPos.add(value);
811                            }
812                    }
813    
814                    List<BlogsStatsUser> list = q.list();
815    
816                    if (list.size() == 2) {
817                            return list.get(1);
818                    }
819                    else {
820                            return null;
821                    }
822            }
823    
824            /**
825             * Finds all the blogs stats users where userId = &#63;.
826             *
827             * @param userId the user id to search with
828             * @return the matching blogs stats users
829             * @throws SystemException if a system exception occurred
830             */
831            public List<BlogsStatsUser> findByUserId(long userId)
832                    throws SystemException {
833                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
834            }
835    
836            /**
837             * Finds a range of all the blogs stats users where userId = &#63;.
838             *
839             * <p>
840             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
841             * </p>
842             *
843             * @param userId the user id to search with
844             * @param start the lower bound of the range of blogs stats users to return
845             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
846             * @return the range of matching blogs stats users
847             * @throws SystemException if a system exception occurred
848             */
849            public List<BlogsStatsUser> findByUserId(long userId, int start, int end)
850                    throws SystemException {
851                    return findByUserId(userId, start, end, null);
852            }
853    
854            /**
855             * Finds an ordered range of all the blogs stats users where userId = &#63;.
856             *
857             * <p>
858             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
859             * </p>
860             *
861             * @param userId the user id to search with
862             * @param start the lower bound of the range of blogs stats users to return
863             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
864             * @param orderByComparator the comparator to order the results by
865             * @return the ordered range of matching blogs stats users
866             * @throws SystemException if a system exception occurred
867             */
868            public List<BlogsStatsUser> findByUserId(long userId, int start, int end,
869                    OrderByComparator orderByComparator) throws SystemException {
870                    Object[] finderArgs = new Object[] {
871                                    userId,
872                                    
873                                    String.valueOf(start), String.valueOf(end),
874                                    String.valueOf(orderByComparator)
875                            };
876    
877                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
878                                    finderArgs, this);
879    
880                    if (list == null) {
881                            Session session = null;
882    
883                            try {
884                                    session = openSession();
885    
886                                    StringBundler query = null;
887    
888                                    if (orderByComparator != null) {
889                                            query = new StringBundler(3 +
890                                                            (orderByComparator.getOrderByFields().length * 3));
891                                    }
892                                    else {
893                                            query = new StringBundler(3);
894                                    }
895    
896                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
897    
898                                    query.append(_FINDER_COLUMN_USERID_USERID_2);
899    
900                                    if (orderByComparator != null) {
901                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
902                                                    orderByComparator);
903                                    }
904    
905                                    else {
906                                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
907                                    }
908    
909                                    String sql = query.toString();
910    
911                                    Query q = session.createQuery(sql);
912    
913                                    QueryPos qPos = QueryPos.getInstance(q);
914    
915                                    qPos.add(userId);
916    
917                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
918                                                    start, end);
919                            }
920                            catch (Exception e) {
921                                    throw processException(e);
922                            }
923                            finally {
924                                    if (list == null) {
925                                            list = new ArrayList<BlogsStatsUser>();
926                                    }
927    
928                                    cacheResult(list);
929    
930                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
931                                            finderArgs, list);
932    
933                                    closeSession(session);
934                            }
935                    }
936    
937                    return list;
938            }
939    
940            /**
941             * Finds the first blogs stats user in the ordered set where userId = &#63;.
942             *
943             * <p>
944             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
945             * </p>
946             *
947             * @param userId the user id to search with
948             * @param orderByComparator the comparator to order the set by
949             * @return the first matching blogs stats user
950             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
951             * @throws SystemException if a system exception occurred
952             */
953            public BlogsStatsUser findByUserId_First(long userId,
954                    OrderByComparator orderByComparator)
955                    throws NoSuchStatsUserException, SystemException {
956                    List<BlogsStatsUser> list = findByUserId(userId, 0, 1, orderByComparator);
957    
958                    if (list.isEmpty()) {
959                            StringBundler msg = new StringBundler(4);
960    
961                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
962    
963                            msg.append("userId=");
964                            msg.append(userId);
965    
966                            msg.append(StringPool.CLOSE_CURLY_BRACE);
967    
968                            throw new NoSuchStatsUserException(msg.toString());
969                    }
970                    else {
971                            return list.get(0);
972                    }
973            }
974    
975            /**
976             * Finds the last blogs stats user in the ordered set where userId = &#63;.
977             *
978             * <p>
979             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
980             * </p>
981             *
982             * @param userId the user id to search with
983             * @param orderByComparator the comparator to order the set by
984             * @return the last matching blogs stats user
985             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
986             * @throws SystemException if a system exception occurred
987             */
988            public BlogsStatsUser findByUserId_Last(long userId,
989                    OrderByComparator orderByComparator)
990                    throws NoSuchStatsUserException, SystemException {
991                    int count = countByUserId(userId);
992    
993                    List<BlogsStatsUser> list = findByUserId(userId, count - 1, count,
994                                    orderByComparator);
995    
996                    if (list.isEmpty()) {
997                            StringBundler msg = new StringBundler(4);
998    
999                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1000    
1001                            msg.append("userId=");
1002                            msg.append(userId);
1003    
1004                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1005    
1006                            throw new NoSuchStatsUserException(msg.toString());
1007                    }
1008                    else {
1009                            return list.get(0);
1010                    }
1011            }
1012    
1013            /**
1014             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where userId = &#63;.
1015             *
1016             * <p>
1017             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1018             * </p>
1019             *
1020             * @param statsUserId the primary key of the current blogs stats user
1021             * @param userId the user id to search with
1022             * @param orderByComparator the comparator to order the set by
1023             * @return the previous, current, and next blogs stats user
1024             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1025             * @throws SystemException if a system exception occurred
1026             */
1027            public BlogsStatsUser[] findByUserId_PrevAndNext(long statsUserId,
1028                    long userId, OrderByComparator orderByComparator)
1029                    throws NoSuchStatsUserException, SystemException {
1030                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1031    
1032                    Session session = null;
1033    
1034                    try {
1035                            session = openSession();
1036    
1037                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1038    
1039                            array[0] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1040                                            orderByComparator, true);
1041    
1042                            array[1] = blogsStatsUser;
1043    
1044                            array[2] = getByUserId_PrevAndNext(session, blogsStatsUser, userId,
1045                                            orderByComparator, false);
1046    
1047                            return array;
1048                    }
1049                    catch (Exception e) {
1050                            throw processException(e);
1051                    }
1052                    finally {
1053                            closeSession(session);
1054                    }
1055            }
1056    
1057            protected BlogsStatsUser getByUserId_PrevAndNext(Session session,
1058                    BlogsStatsUser blogsStatsUser, long userId,
1059                    OrderByComparator orderByComparator, boolean previous) {
1060                    StringBundler query = null;
1061    
1062                    if (orderByComparator != null) {
1063                            query = new StringBundler(6 +
1064                                            (orderByComparator.getOrderByFields().length * 6));
1065                    }
1066                    else {
1067                            query = new StringBundler(3);
1068                    }
1069    
1070                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1071    
1072                    query.append(_FINDER_COLUMN_USERID_USERID_2);
1073    
1074                    if (orderByComparator != null) {
1075                            String[] orderByFields = orderByComparator.getOrderByFields();
1076    
1077                            if (orderByFields.length > 0) {
1078                                    query.append(WHERE_AND);
1079                            }
1080    
1081                            for (int i = 0; i < orderByFields.length; i++) {
1082                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1083                                    query.append(orderByFields[i]);
1084    
1085                                    if ((i + 1) < orderByFields.length) {
1086                                            if (orderByComparator.isAscending() ^ previous) {
1087                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1088                                            }
1089                                            else {
1090                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1091                                            }
1092                                    }
1093                                    else {
1094                                            if (orderByComparator.isAscending() ^ previous) {
1095                                                    query.append(WHERE_GREATER_THAN);
1096                                            }
1097                                            else {
1098                                                    query.append(WHERE_LESSER_THAN);
1099                                            }
1100                                    }
1101                            }
1102    
1103                            query.append(ORDER_BY_CLAUSE);
1104    
1105                            for (int i = 0; i < orderByFields.length; i++) {
1106                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1107                                    query.append(orderByFields[i]);
1108    
1109                                    if ((i + 1) < orderByFields.length) {
1110                                            if (orderByComparator.isAscending() ^ previous) {
1111                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1112                                            }
1113                                            else {
1114                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1115                                            }
1116                                    }
1117                                    else {
1118                                            if (orderByComparator.isAscending() ^ previous) {
1119                                                    query.append(ORDER_BY_ASC);
1120                                            }
1121                                            else {
1122                                                    query.append(ORDER_BY_DESC);
1123                                            }
1124                                    }
1125                            }
1126                    }
1127    
1128                    else {
1129                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1130                    }
1131    
1132                    String sql = query.toString();
1133    
1134                    Query q = session.createQuery(sql);
1135    
1136                    q.setFirstResult(0);
1137                    q.setMaxResults(2);
1138    
1139                    QueryPos qPos = QueryPos.getInstance(q);
1140    
1141                    qPos.add(userId);
1142    
1143                    if (orderByComparator != null) {
1144                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
1145    
1146                            for (Object value : values) {
1147                                    qPos.add(value);
1148                            }
1149                    }
1150    
1151                    List<BlogsStatsUser> list = q.list();
1152    
1153                    if (list.size() == 2) {
1154                            return list.get(1);
1155                    }
1156                    else {
1157                            return null;
1158                    }
1159            }
1160    
1161            /**
1162             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or throws a {@link com.liferay.portlet.blogs.NoSuchStatsUserException} if it could not be found.
1163             *
1164             * @param groupId the group id to search with
1165             * @param userId the user id to search with
1166             * @return the matching blogs stats user
1167             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1168             * @throws SystemException if a system exception occurred
1169             */
1170            public BlogsStatsUser findByG_U(long groupId, long userId)
1171                    throws NoSuchStatsUserException, SystemException {
1172                    BlogsStatsUser blogsStatsUser = fetchByG_U(groupId, userId);
1173    
1174                    if (blogsStatsUser == null) {
1175                            StringBundler msg = new StringBundler(6);
1176    
1177                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1178    
1179                            msg.append("groupId=");
1180                            msg.append(groupId);
1181    
1182                            msg.append(", userId=");
1183                            msg.append(userId);
1184    
1185                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1186    
1187                            if (_log.isWarnEnabled()) {
1188                                    _log.warn(msg.toString());
1189                            }
1190    
1191                            throw new NoSuchStatsUserException(msg.toString());
1192                    }
1193    
1194                    return blogsStatsUser;
1195            }
1196    
1197            /**
1198             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1199             *
1200             * @param groupId the group id to search with
1201             * @param userId the user id to search with
1202             * @return the matching blogs stats user, or <code>null</code> if a matching blogs stats user could not be found
1203             * @throws SystemException if a system exception occurred
1204             */
1205            public BlogsStatsUser fetchByG_U(long groupId, long userId)
1206                    throws SystemException {
1207                    return fetchByG_U(groupId, userId, true);
1208            }
1209    
1210            /**
1211             * Finds the blogs stats user where groupId = &#63; and userId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1212             *
1213             * @param groupId the group id to search with
1214             * @param userId the user id to search with
1215             * @return the matching blogs stats user, or <code>null</code> if a matching blogs stats user could not be found
1216             * @throws SystemException if a system exception occurred
1217             */
1218            public BlogsStatsUser fetchByG_U(long groupId, long userId,
1219                    boolean retrieveFromCache) throws SystemException {
1220                    Object[] finderArgs = new Object[] { groupId, userId };
1221    
1222                    Object result = null;
1223    
1224                    if (retrieveFromCache) {
1225                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_U,
1226                                            finderArgs, this);
1227                    }
1228    
1229                    if (result == null) {
1230                            Session session = null;
1231    
1232                            try {
1233                                    session = openSession();
1234    
1235                                    StringBundler query = new StringBundler(4);
1236    
1237                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1238    
1239                                    query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1240    
1241                                    query.append(_FINDER_COLUMN_G_U_USERID_2);
1242    
1243                                    query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1244    
1245                                    String sql = query.toString();
1246    
1247                                    Query q = session.createQuery(sql);
1248    
1249                                    QueryPos qPos = QueryPos.getInstance(q);
1250    
1251                                    qPos.add(groupId);
1252    
1253                                    qPos.add(userId);
1254    
1255                                    List<BlogsStatsUser> list = q.list();
1256    
1257                                    result = list;
1258    
1259                                    BlogsStatsUser blogsStatsUser = null;
1260    
1261                                    if (list.isEmpty()) {
1262                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1263                                                    finderArgs, list);
1264                                    }
1265                                    else {
1266                                            blogsStatsUser = list.get(0);
1267    
1268                                            cacheResult(blogsStatsUser);
1269    
1270                                            if ((blogsStatsUser.getGroupId() != groupId) ||
1271                                                            (blogsStatsUser.getUserId() != userId)) {
1272                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1273                                                            finderArgs, blogsStatsUser);
1274                                            }
1275                                    }
1276    
1277                                    return blogsStatsUser;
1278                            }
1279                            catch (Exception e) {
1280                                    throw processException(e);
1281                            }
1282                            finally {
1283                                    if (result == null) {
1284                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_U,
1285                                                    finderArgs, new ArrayList<BlogsStatsUser>());
1286                                    }
1287    
1288                                    closeSession(session);
1289                            }
1290                    }
1291                    else {
1292                            if (result instanceof List<?>) {
1293                                    return null;
1294                            }
1295                            else {
1296                                    return (BlogsStatsUser)result;
1297                            }
1298                    }
1299            }
1300    
1301            /**
1302             * Finds all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1303             *
1304             * @param groupId the group id to search with
1305             * @param entryCount the entry count to search with
1306             * @return the matching blogs stats users
1307             * @throws SystemException if a system exception occurred
1308             */
1309            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount)
1310                    throws SystemException {
1311                    return findByG_NotE(groupId, entryCount, QueryUtil.ALL_POS,
1312                            QueryUtil.ALL_POS, null);
1313            }
1314    
1315            /**
1316             * Finds a range of all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1317             *
1318             * <p>
1319             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1320             * </p>
1321             *
1322             * @param groupId the group id to search with
1323             * @param entryCount the entry count to search with
1324             * @param start the lower bound of the range of blogs stats users to return
1325             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1326             * @return the range of matching blogs stats users
1327             * @throws SystemException if a system exception occurred
1328             */
1329            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1330                    int start, int end) throws SystemException {
1331                    return findByG_NotE(groupId, entryCount, start, end, null);
1332            }
1333    
1334            /**
1335             * Finds an ordered range of all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
1336             *
1337             * <p>
1338             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1339             * </p>
1340             *
1341             * @param groupId the group id to search with
1342             * @param entryCount the entry count to search with
1343             * @param start the lower bound of the range of blogs stats users to return
1344             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1345             * @param orderByComparator the comparator to order the results by
1346             * @return the ordered range of matching blogs stats users
1347             * @throws SystemException if a system exception occurred
1348             */
1349            public List<BlogsStatsUser> findByG_NotE(long groupId, int entryCount,
1350                    int start, int end, OrderByComparator orderByComparator)
1351                    throws SystemException {
1352                    Object[] finderArgs = new Object[] {
1353                                    groupId, entryCount,
1354                                    
1355                                    String.valueOf(start), String.valueOf(end),
1356                                    String.valueOf(orderByComparator)
1357                            };
1358    
1359                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_NOTE,
1360                                    finderArgs, this);
1361    
1362                    if (list == null) {
1363                            Session session = null;
1364    
1365                            try {
1366                                    session = openSession();
1367    
1368                                    StringBundler query = null;
1369    
1370                                    if (orderByComparator != null) {
1371                                            query = new StringBundler(4 +
1372                                                            (orderByComparator.getOrderByFields().length * 3));
1373                                    }
1374                                    else {
1375                                            query = new StringBundler(4);
1376                                    }
1377    
1378                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1379    
1380                                    query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1381    
1382                                    query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1383    
1384                                    if (orderByComparator != null) {
1385                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1386                                                    orderByComparator);
1387                                    }
1388    
1389                                    else {
1390                                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1391                                    }
1392    
1393                                    String sql = query.toString();
1394    
1395                                    Query q = session.createQuery(sql);
1396    
1397                                    QueryPos qPos = QueryPos.getInstance(q);
1398    
1399                                    qPos.add(groupId);
1400    
1401                                    qPos.add(entryCount);
1402    
1403                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1404                                                    start, end);
1405                            }
1406                            catch (Exception e) {
1407                                    throw processException(e);
1408                            }
1409                            finally {
1410                                    if (list == null) {
1411                                            list = new ArrayList<BlogsStatsUser>();
1412                                    }
1413    
1414                                    cacheResult(list);
1415    
1416                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_NOTE,
1417                                            finderArgs, list);
1418    
1419                                    closeSession(session);
1420                            }
1421                    }
1422    
1423                    return list;
1424            }
1425    
1426            /**
1427             * Finds the first blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1428             *
1429             * <p>
1430             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1431             * </p>
1432             *
1433             * @param groupId the group id to search with
1434             * @param entryCount the entry count to search with
1435             * @param orderByComparator the comparator to order the set by
1436             * @return the first matching blogs stats user
1437             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1438             * @throws SystemException if a system exception occurred
1439             */
1440            public BlogsStatsUser findByG_NotE_First(long groupId, int entryCount,
1441                    OrderByComparator orderByComparator)
1442                    throws NoSuchStatsUserException, SystemException {
1443                    List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount, 0, 1,
1444                                    orderByComparator);
1445    
1446                    if (list.isEmpty()) {
1447                            StringBundler msg = new StringBundler(6);
1448    
1449                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1450    
1451                            msg.append("groupId=");
1452                            msg.append(groupId);
1453    
1454                            msg.append(", entryCount=");
1455                            msg.append(entryCount);
1456    
1457                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1458    
1459                            throw new NoSuchStatsUserException(msg.toString());
1460                    }
1461                    else {
1462                            return list.get(0);
1463                    }
1464            }
1465    
1466            /**
1467             * Finds the last blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1468             *
1469             * <p>
1470             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1471             * </p>
1472             *
1473             * @param groupId the group id to search with
1474             * @param entryCount the entry count to search with
1475             * @param orderByComparator the comparator to order the set by
1476             * @return the last matching blogs stats user
1477             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1478             * @throws SystemException if a system exception occurred
1479             */
1480            public BlogsStatsUser findByG_NotE_Last(long groupId, int entryCount,
1481                    OrderByComparator orderByComparator)
1482                    throws NoSuchStatsUserException, SystemException {
1483                    int count = countByG_NotE(groupId, entryCount);
1484    
1485                    List<BlogsStatsUser> list = findByG_NotE(groupId, entryCount,
1486                                    count - 1, count, orderByComparator);
1487    
1488                    if (list.isEmpty()) {
1489                            StringBundler msg = new StringBundler(6);
1490    
1491                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1492    
1493                            msg.append("groupId=");
1494                            msg.append(groupId);
1495    
1496                            msg.append(", entryCount=");
1497                            msg.append(entryCount);
1498    
1499                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1500    
1501                            throw new NoSuchStatsUserException(msg.toString());
1502                    }
1503                    else {
1504                            return list.get(0);
1505                    }
1506            }
1507    
1508            /**
1509             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where groupId = &#63; and entryCount &ne; &#63;.
1510             *
1511             * <p>
1512             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1513             * </p>
1514             *
1515             * @param statsUserId the primary key of the current blogs stats user
1516             * @param groupId the group id to search with
1517             * @param entryCount the entry count to search with
1518             * @param orderByComparator the comparator to order the set by
1519             * @return the previous, current, and next blogs stats user
1520             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1521             * @throws SystemException if a system exception occurred
1522             */
1523            public BlogsStatsUser[] findByG_NotE_PrevAndNext(long statsUserId,
1524                    long groupId, int entryCount, OrderByComparator orderByComparator)
1525                    throws NoSuchStatsUserException, SystemException {
1526                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1527    
1528                    Session session = null;
1529    
1530                    try {
1531                            session = openSession();
1532    
1533                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1534    
1535                            array[0] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1536                                            groupId, entryCount, orderByComparator, true);
1537    
1538                            array[1] = blogsStatsUser;
1539    
1540                            array[2] = getByG_NotE_PrevAndNext(session, blogsStatsUser,
1541                                            groupId, entryCount, orderByComparator, false);
1542    
1543                            return array;
1544                    }
1545                    catch (Exception e) {
1546                            throw processException(e);
1547                    }
1548                    finally {
1549                            closeSession(session);
1550                    }
1551            }
1552    
1553            protected BlogsStatsUser getByG_NotE_PrevAndNext(Session session,
1554                    BlogsStatsUser blogsStatsUser, long groupId, int entryCount,
1555                    OrderByComparator orderByComparator, boolean previous) {
1556                    StringBundler query = null;
1557    
1558                    if (orderByComparator != null) {
1559                            query = new StringBundler(6 +
1560                                            (orderByComparator.getOrderByFields().length * 6));
1561                    }
1562                    else {
1563                            query = new StringBundler(3);
1564                    }
1565    
1566                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1567    
1568                    query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
1569    
1570                    query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
1571    
1572                    if (orderByComparator != null) {
1573                            String[] orderByFields = orderByComparator.getOrderByFields();
1574    
1575                            if (orderByFields.length > 0) {
1576                                    query.append(WHERE_AND);
1577                            }
1578    
1579                            for (int i = 0; i < orderByFields.length; i++) {
1580                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1581                                    query.append(orderByFields[i]);
1582    
1583                                    if ((i + 1) < orderByFields.length) {
1584                                            if (orderByComparator.isAscending() ^ previous) {
1585                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1586                                            }
1587                                            else {
1588                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1589                                            }
1590                                    }
1591                                    else {
1592                                            if (orderByComparator.isAscending() ^ previous) {
1593                                                    query.append(WHERE_GREATER_THAN);
1594                                            }
1595                                            else {
1596                                                    query.append(WHERE_LESSER_THAN);
1597                                            }
1598                                    }
1599                            }
1600    
1601                            query.append(ORDER_BY_CLAUSE);
1602    
1603                            for (int i = 0; i < orderByFields.length; i++) {
1604                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1605                                    query.append(orderByFields[i]);
1606    
1607                                    if ((i + 1) < orderByFields.length) {
1608                                            if (orderByComparator.isAscending() ^ previous) {
1609                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1610                                            }
1611                                            else {
1612                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1613                                            }
1614                                    }
1615                                    else {
1616                                            if (orderByComparator.isAscending() ^ previous) {
1617                                                    query.append(ORDER_BY_ASC);
1618                                            }
1619                                            else {
1620                                                    query.append(ORDER_BY_DESC);
1621                                            }
1622                                    }
1623                            }
1624                    }
1625    
1626                    else {
1627                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1628                    }
1629    
1630                    String sql = query.toString();
1631    
1632                    Query q = session.createQuery(sql);
1633    
1634                    q.setFirstResult(0);
1635                    q.setMaxResults(2);
1636    
1637                    QueryPos qPos = QueryPos.getInstance(q);
1638    
1639                    qPos.add(groupId);
1640    
1641                    qPos.add(entryCount);
1642    
1643                    if (orderByComparator != null) {
1644                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
1645    
1646                            for (Object value : values) {
1647                                    qPos.add(value);
1648                            }
1649                    }
1650    
1651                    List<BlogsStatsUser> list = q.list();
1652    
1653                    if (list.size() == 2) {
1654                            return list.get(1);
1655                    }
1656                    else {
1657                            return null;
1658                    }
1659            }
1660    
1661            /**
1662             * Finds all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1663             *
1664             * @param companyId the company id to search with
1665             * @param entryCount the entry count to search with
1666             * @return the matching blogs stats users
1667             * @throws SystemException if a system exception occurred
1668             */
1669            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount)
1670                    throws SystemException {
1671                    return findByC_NotE(companyId, entryCount, QueryUtil.ALL_POS,
1672                            QueryUtil.ALL_POS, null);
1673            }
1674    
1675            /**
1676             * Finds a range of all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1677             *
1678             * <p>
1679             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1680             * </p>
1681             *
1682             * @param companyId the company id to search with
1683             * @param entryCount the entry count to search with
1684             * @param start the lower bound of the range of blogs stats users to return
1685             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1686             * @return the range of matching blogs stats users
1687             * @throws SystemException if a system exception occurred
1688             */
1689            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
1690                    int start, int end) throws SystemException {
1691                    return findByC_NotE(companyId, entryCount, start, end, null);
1692            }
1693    
1694            /**
1695             * Finds an ordered range of all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
1696             *
1697             * <p>
1698             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1699             * </p>
1700             *
1701             * @param companyId the company id to search with
1702             * @param entryCount the entry count to search with
1703             * @param start the lower bound of the range of blogs stats users to return
1704             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
1705             * @param orderByComparator the comparator to order the results by
1706             * @return the ordered range of matching blogs stats users
1707             * @throws SystemException if a system exception occurred
1708             */
1709            public List<BlogsStatsUser> findByC_NotE(long companyId, int entryCount,
1710                    int start, int end, OrderByComparator orderByComparator)
1711                    throws SystemException {
1712                    Object[] finderArgs = new Object[] {
1713                                    companyId, entryCount,
1714                                    
1715                                    String.valueOf(start), String.valueOf(end),
1716                                    String.valueOf(orderByComparator)
1717                            };
1718    
1719                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_NOTE,
1720                                    finderArgs, this);
1721    
1722                    if (list == null) {
1723                            Session session = null;
1724    
1725                            try {
1726                                    session = openSession();
1727    
1728                                    StringBundler query = null;
1729    
1730                                    if (orderByComparator != null) {
1731                                            query = new StringBundler(4 +
1732                                                            (orderByComparator.getOrderByFields().length * 3));
1733                                    }
1734                                    else {
1735                                            query = new StringBundler(4);
1736                                    }
1737    
1738                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1739    
1740                                    query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
1741    
1742                                    query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
1743    
1744                                    if (orderByComparator != null) {
1745                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1746                                                    orderByComparator);
1747                                    }
1748    
1749                                    else {
1750                                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1751                                    }
1752    
1753                                    String sql = query.toString();
1754    
1755                                    Query q = session.createQuery(sql);
1756    
1757                                    QueryPos qPos = QueryPos.getInstance(q);
1758    
1759                                    qPos.add(companyId);
1760    
1761                                    qPos.add(entryCount);
1762    
1763                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
1764                                                    start, end);
1765                            }
1766                            catch (Exception e) {
1767                                    throw processException(e);
1768                            }
1769                            finally {
1770                                    if (list == null) {
1771                                            list = new ArrayList<BlogsStatsUser>();
1772                                    }
1773    
1774                                    cacheResult(list);
1775    
1776                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_NOTE,
1777                                            finderArgs, list);
1778    
1779                                    closeSession(session);
1780                            }
1781                    }
1782    
1783                    return list;
1784            }
1785    
1786            /**
1787             * Finds the first blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1788             *
1789             * <p>
1790             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1791             * </p>
1792             *
1793             * @param companyId the company id to search with
1794             * @param entryCount the entry count to search with
1795             * @param orderByComparator the comparator to order the set by
1796             * @return the first matching blogs stats user
1797             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1798             * @throws SystemException if a system exception occurred
1799             */
1800            public BlogsStatsUser findByC_NotE_First(long companyId, int entryCount,
1801                    OrderByComparator orderByComparator)
1802                    throws NoSuchStatsUserException, SystemException {
1803                    List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount, 0, 1,
1804                                    orderByComparator);
1805    
1806                    if (list.isEmpty()) {
1807                            StringBundler msg = new StringBundler(6);
1808    
1809                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1810    
1811                            msg.append("companyId=");
1812                            msg.append(companyId);
1813    
1814                            msg.append(", entryCount=");
1815                            msg.append(entryCount);
1816    
1817                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1818    
1819                            throw new NoSuchStatsUserException(msg.toString());
1820                    }
1821                    else {
1822                            return list.get(0);
1823                    }
1824            }
1825    
1826            /**
1827             * Finds the last blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1828             *
1829             * <p>
1830             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1831             * </p>
1832             *
1833             * @param companyId the company id to search with
1834             * @param entryCount the entry count to search with
1835             * @param orderByComparator the comparator to order the set by
1836             * @return the last matching blogs stats user
1837             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
1838             * @throws SystemException if a system exception occurred
1839             */
1840            public BlogsStatsUser findByC_NotE_Last(long companyId, int entryCount,
1841                    OrderByComparator orderByComparator)
1842                    throws NoSuchStatsUserException, SystemException {
1843                    int count = countByC_NotE(companyId, entryCount);
1844    
1845                    List<BlogsStatsUser> list = findByC_NotE(companyId, entryCount,
1846                                    count - 1, count, orderByComparator);
1847    
1848                    if (list.isEmpty()) {
1849                            StringBundler msg = new StringBundler(6);
1850    
1851                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1852    
1853                            msg.append("companyId=");
1854                            msg.append(companyId);
1855    
1856                            msg.append(", entryCount=");
1857                            msg.append(entryCount);
1858    
1859                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1860    
1861                            throw new NoSuchStatsUserException(msg.toString());
1862                    }
1863                    else {
1864                            return list.get(0);
1865                    }
1866            }
1867    
1868            /**
1869             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where companyId = &#63; and entryCount &ne; &#63;.
1870             *
1871             * <p>
1872             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1873             * </p>
1874             *
1875             * @param statsUserId the primary key of the current blogs stats user
1876             * @param companyId the company id to search with
1877             * @param entryCount the entry count to search with
1878             * @param orderByComparator the comparator to order the set by
1879             * @return the previous, current, and next blogs stats user
1880             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
1881             * @throws SystemException if a system exception occurred
1882             */
1883            public BlogsStatsUser[] findByC_NotE_PrevAndNext(long statsUserId,
1884                    long companyId, int entryCount, OrderByComparator orderByComparator)
1885                    throws NoSuchStatsUserException, SystemException {
1886                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
1887    
1888                    Session session = null;
1889    
1890                    try {
1891                            session = openSession();
1892    
1893                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
1894    
1895                            array[0] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
1896                                            companyId, entryCount, orderByComparator, true);
1897    
1898                            array[1] = blogsStatsUser;
1899    
1900                            array[2] = getByC_NotE_PrevAndNext(session, blogsStatsUser,
1901                                            companyId, entryCount, orderByComparator, false);
1902    
1903                            return array;
1904                    }
1905                    catch (Exception e) {
1906                            throw processException(e);
1907                    }
1908                    finally {
1909                            closeSession(session);
1910                    }
1911            }
1912    
1913            protected BlogsStatsUser getByC_NotE_PrevAndNext(Session session,
1914                    BlogsStatsUser blogsStatsUser, long companyId, int entryCount,
1915                    OrderByComparator orderByComparator, boolean previous) {
1916                    StringBundler query = null;
1917    
1918                    if (orderByComparator != null) {
1919                            query = new StringBundler(6 +
1920                                            (orderByComparator.getOrderByFields().length * 6));
1921                    }
1922                    else {
1923                            query = new StringBundler(3);
1924                    }
1925    
1926                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
1927    
1928                    query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
1929    
1930                    query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
1931    
1932                    if (orderByComparator != null) {
1933                            String[] orderByFields = orderByComparator.getOrderByFields();
1934    
1935                            if (orderByFields.length > 0) {
1936                                    query.append(WHERE_AND);
1937                            }
1938    
1939                            for (int i = 0; i < orderByFields.length; i++) {
1940                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1941                                    query.append(orderByFields[i]);
1942    
1943                                    if ((i + 1) < orderByFields.length) {
1944                                            if (orderByComparator.isAscending() ^ previous) {
1945                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1946                                            }
1947                                            else {
1948                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1949                                            }
1950                                    }
1951                                    else {
1952                                            if (orderByComparator.isAscending() ^ previous) {
1953                                                    query.append(WHERE_GREATER_THAN);
1954                                            }
1955                                            else {
1956                                                    query.append(WHERE_LESSER_THAN);
1957                                            }
1958                                    }
1959                            }
1960    
1961                            query.append(ORDER_BY_CLAUSE);
1962    
1963                            for (int i = 0; i < orderByFields.length; i++) {
1964                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1965                                    query.append(orderByFields[i]);
1966    
1967                                    if ((i + 1) < orderByFields.length) {
1968                                            if (orderByComparator.isAscending() ^ previous) {
1969                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1970                                            }
1971                                            else {
1972                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1973                                            }
1974                                    }
1975                                    else {
1976                                            if (orderByComparator.isAscending() ^ previous) {
1977                                                    query.append(ORDER_BY_ASC);
1978                                            }
1979                                            else {
1980                                                    query.append(ORDER_BY_DESC);
1981                                            }
1982                                    }
1983                            }
1984                    }
1985    
1986                    else {
1987                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
1988                    }
1989    
1990                    String sql = query.toString();
1991    
1992                    Query q = session.createQuery(sql);
1993    
1994                    q.setFirstResult(0);
1995                    q.setMaxResults(2);
1996    
1997                    QueryPos qPos = QueryPos.getInstance(q);
1998    
1999                    qPos.add(companyId);
2000    
2001                    qPos.add(entryCount);
2002    
2003                    if (orderByComparator != null) {
2004                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
2005    
2006                            for (Object value : values) {
2007                                    qPos.add(value);
2008                            }
2009                    }
2010    
2011                    List<BlogsStatsUser> list = q.list();
2012    
2013                    if (list.size() == 2) {
2014                            return list.get(1);
2015                    }
2016                    else {
2017                            return null;
2018                    }
2019            }
2020    
2021            /**
2022             * Finds all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2023             *
2024             * @param userId the user id to search with
2025             * @param lastPostDate the last post date to search with
2026             * @return the matching blogs stats users
2027             * @throws SystemException if a system exception occurred
2028             */
2029            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate)
2030                    throws SystemException {
2031                    return findByU_L(userId, lastPostDate, QueryUtil.ALL_POS,
2032                            QueryUtil.ALL_POS, null);
2033            }
2034    
2035            /**
2036             * Finds a range of all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2037             *
2038             * <p>
2039             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2040             * </p>
2041             *
2042             * @param userId the user id to search with
2043             * @param lastPostDate the last post date to search with
2044             * @param start the lower bound of the range of blogs stats users to return
2045             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2046             * @return the range of matching blogs stats users
2047             * @throws SystemException if a system exception occurred
2048             */
2049            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2050                    int start, int end) throws SystemException {
2051                    return findByU_L(userId, lastPostDate, start, end, null);
2052            }
2053    
2054            /**
2055             * Finds an ordered range of all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2056             *
2057             * <p>
2058             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2059             * </p>
2060             *
2061             * @param userId the user id to search with
2062             * @param lastPostDate the last post date to search with
2063             * @param start the lower bound of the range of blogs stats users to return
2064             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2065             * @param orderByComparator the comparator to order the results by
2066             * @return the ordered range of matching blogs stats users
2067             * @throws SystemException if a system exception occurred
2068             */
2069            public List<BlogsStatsUser> findByU_L(long userId, Date lastPostDate,
2070                    int start, int end, OrderByComparator orderByComparator)
2071                    throws SystemException {
2072                    Object[] finderArgs = new Object[] {
2073                                    userId, lastPostDate,
2074                                    
2075                                    String.valueOf(start), String.valueOf(end),
2076                                    String.valueOf(orderByComparator)
2077                            };
2078    
2079                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U_L,
2080                                    finderArgs, this);
2081    
2082                    if (list == null) {
2083                            Session session = null;
2084    
2085                            try {
2086                                    session = openSession();
2087    
2088                                    StringBundler query = null;
2089    
2090                                    if (orderByComparator != null) {
2091                                            query = new StringBundler(4 +
2092                                                            (orderByComparator.getOrderByFields().length * 3));
2093                                    }
2094                                    else {
2095                                            query = new StringBundler(4);
2096                                    }
2097    
2098                                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2099    
2100                                    query.append(_FINDER_COLUMN_U_L_USERID_2);
2101    
2102                                    if (lastPostDate == null) {
2103                                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2104                                    }
2105                                    else {
2106                                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2107                                    }
2108    
2109                                    if (orderByComparator != null) {
2110                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2111                                                    orderByComparator);
2112                                    }
2113    
2114                                    else {
2115                                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2116                                    }
2117    
2118                                    String sql = query.toString();
2119    
2120                                    Query q = session.createQuery(sql);
2121    
2122                                    QueryPos qPos = QueryPos.getInstance(q);
2123    
2124                                    qPos.add(userId);
2125    
2126                                    if (lastPostDate != null) {
2127                                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2128                                    }
2129    
2130                                    list = (List<BlogsStatsUser>)QueryUtil.list(q, getDialect(),
2131                                                    start, end);
2132                            }
2133                            catch (Exception e) {
2134                                    throw processException(e);
2135                            }
2136                            finally {
2137                                    if (list == null) {
2138                                            list = new ArrayList<BlogsStatsUser>();
2139                                    }
2140    
2141                                    cacheResult(list);
2142    
2143                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U_L, finderArgs,
2144                                            list);
2145    
2146                                    closeSession(session);
2147                            }
2148                    }
2149    
2150                    return list;
2151            }
2152    
2153            /**
2154             * Finds the first blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2155             *
2156             * <p>
2157             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2158             * </p>
2159             *
2160             * @param userId the user id to search with
2161             * @param lastPostDate the last post date to search with
2162             * @param orderByComparator the comparator to order the set by
2163             * @return the first matching blogs stats user
2164             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
2165             * @throws SystemException if a system exception occurred
2166             */
2167            public BlogsStatsUser findByU_L_First(long userId, Date lastPostDate,
2168                    OrderByComparator orderByComparator)
2169                    throws NoSuchStatsUserException, SystemException {
2170                    List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, 0, 1,
2171                                    orderByComparator);
2172    
2173                    if (list.isEmpty()) {
2174                            StringBundler msg = new StringBundler(6);
2175    
2176                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2177    
2178                            msg.append("userId=");
2179                            msg.append(userId);
2180    
2181                            msg.append(", lastPostDate=");
2182                            msg.append(lastPostDate);
2183    
2184                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2185    
2186                            throw new NoSuchStatsUserException(msg.toString());
2187                    }
2188                    else {
2189                            return list.get(0);
2190                    }
2191            }
2192    
2193            /**
2194             * Finds the last blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2195             *
2196             * <p>
2197             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2198             * </p>
2199             *
2200             * @param userId the user id to search with
2201             * @param lastPostDate the last post date to search with
2202             * @param orderByComparator the comparator to order the set by
2203             * @return the last matching blogs stats user
2204             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a matching blogs stats user could not be found
2205             * @throws SystemException if a system exception occurred
2206             */
2207            public BlogsStatsUser findByU_L_Last(long userId, Date lastPostDate,
2208                    OrderByComparator orderByComparator)
2209                    throws NoSuchStatsUserException, SystemException {
2210                    int count = countByU_L(userId, lastPostDate);
2211    
2212                    List<BlogsStatsUser> list = findByU_L(userId, lastPostDate, count - 1,
2213                                    count, orderByComparator);
2214    
2215                    if (list.isEmpty()) {
2216                            StringBundler msg = new StringBundler(6);
2217    
2218                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2219    
2220                            msg.append("userId=");
2221                            msg.append(userId);
2222    
2223                            msg.append(", lastPostDate=");
2224                            msg.append(lastPostDate);
2225    
2226                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2227    
2228                            throw new NoSuchStatsUserException(msg.toString());
2229                    }
2230                    else {
2231                            return list.get(0);
2232                    }
2233            }
2234    
2235            /**
2236             * Finds the blogs stats users before and after the current blogs stats user in the ordered set where userId = &#63; and lastPostDate = &#63;.
2237             *
2238             * <p>
2239             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2240             * </p>
2241             *
2242             * @param statsUserId the primary key of the current blogs stats user
2243             * @param userId the user id to search with
2244             * @param lastPostDate the last post date to search with
2245             * @param orderByComparator the comparator to order the set by
2246             * @return the previous, current, and next blogs stats user
2247             * @throws com.liferay.portlet.blogs.NoSuchStatsUserException if a blogs stats user with the primary key could not be found
2248             * @throws SystemException if a system exception occurred
2249             */
2250            public BlogsStatsUser[] findByU_L_PrevAndNext(long statsUserId,
2251                    long userId, Date lastPostDate, OrderByComparator orderByComparator)
2252                    throws NoSuchStatsUserException, SystemException {
2253                    BlogsStatsUser blogsStatsUser = findByPrimaryKey(statsUserId);
2254    
2255                    Session session = null;
2256    
2257                    try {
2258                            session = openSession();
2259    
2260                            BlogsStatsUser[] array = new BlogsStatsUserImpl[3];
2261    
2262                            array[0] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2263                                            lastPostDate, orderByComparator, true);
2264    
2265                            array[1] = blogsStatsUser;
2266    
2267                            array[2] = getByU_L_PrevAndNext(session, blogsStatsUser, userId,
2268                                            lastPostDate, orderByComparator, false);
2269    
2270                            return array;
2271                    }
2272                    catch (Exception e) {
2273                            throw processException(e);
2274                    }
2275                    finally {
2276                            closeSession(session);
2277                    }
2278            }
2279    
2280            protected BlogsStatsUser getByU_L_PrevAndNext(Session session,
2281                    BlogsStatsUser blogsStatsUser, long userId, Date lastPostDate,
2282                    OrderByComparator orderByComparator, boolean previous) {
2283                    StringBundler query = null;
2284    
2285                    if (orderByComparator != null) {
2286                            query = new StringBundler(6 +
2287                                            (orderByComparator.getOrderByFields().length * 6));
2288                    }
2289                    else {
2290                            query = new StringBundler(3);
2291                    }
2292    
2293                    query.append(_SQL_SELECT_BLOGSSTATSUSER_WHERE);
2294    
2295                    query.append(_FINDER_COLUMN_U_L_USERID_2);
2296    
2297                    if (lastPostDate == null) {
2298                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2299                    }
2300                    else {
2301                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2302                    }
2303    
2304                    if (orderByComparator != null) {
2305                            String[] orderByFields = orderByComparator.getOrderByFields();
2306    
2307                            if (orderByFields.length > 0) {
2308                                    query.append(WHERE_AND);
2309                            }
2310    
2311                            for (int i = 0; i < orderByFields.length; i++) {
2312                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2313                                    query.append(orderByFields[i]);
2314    
2315                                    if ((i + 1) < orderByFields.length) {
2316                                            if (orderByComparator.isAscending() ^ previous) {
2317                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2318                                            }
2319                                            else {
2320                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2321                                            }
2322                                    }
2323                                    else {
2324                                            if (orderByComparator.isAscending() ^ previous) {
2325                                                    query.append(WHERE_GREATER_THAN);
2326                                            }
2327                                            else {
2328                                                    query.append(WHERE_LESSER_THAN);
2329                                            }
2330                                    }
2331                            }
2332    
2333                            query.append(ORDER_BY_CLAUSE);
2334    
2335                            for (int i = 0; i < orderByFields.length; i++) {
2336                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2337                                    query.append(orderByFields[i]);
2338    
2339                                    if ((i + 1) < orderByFields.length) {
2340                                            if (orderByComparator.isAscending() ^ previous) {
2341                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2342                                            }
2343                                            else {
2344                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2345                                            }
2346                                    }
2347                                    else {
2348                                            if (orderByComparator.isAscending() ^ previous) {
2349                                                    query.append(ORDER_BY_ASC);
2350                                            }
2351                                            else {
2352                                                    query.append(ORDER_BY_DESC);
2353                                            }
2354                                    }
2355                            }
2356                    }
2357    
2358                    else {
2359                            query.append(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2360                    }
2361    
2362                    String sql = query.toString();
2363    
2364                    Query q = session.createQuery(sql);
2365    
2366                    q.setFirstResult(0);
2367                    q.setMaxResults(2);
2368    
2369                    QueryPos qPos = QueryPos.getInstance(q);
2370    
2371                    qPos.add(userId);
2372    
2373                    if (lastPostDate != null) {
2374                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2375                    }
2376    
2377                    if (orderByComparator != null) {
2378                            Object[] values = orderByComparator.getOrderByValues(blogsStatsUser);
2379    
2380                            for (Object value : values) {
2381                                    qPos.add(value);
2382                            }
2383                    }
2384    
2385                    List<BlogsStatsUser> list = q.list();
2386    
2387                    if (list.size() == 2) {
2388                            return list.get(1);
2389                    }
2390                    else {
2391                            return null;
2392                    }
2393            }
2394    
2395            /**
2396             * Finds all the blogs stats users.
2397             *
2398             * @return the blogs stats users
2399             * @throws SystemException if a system exception occurred
2400             */
2401            public List<BlogsStatsUser> findAll() throws SystemException {
2402                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2403            }
2404    
2405            /**
2406             * Finds a range of all the blogs stats users.
2407             *
2408             * <p>
2409             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2410             * </p>
2411             *
2412             * @param start the lower bound of the range of blogs stats users to return
2413             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2414             * @return the range of blogs stats users
2415             * @throws SystemException if a system exception occurred
2416             */
2417            public List<BlogsStatsUser> findAll(int start, int end)
2418                    throws SystemException {
2419                    return findAll(start, end, null);
2420            }
2421    
2422            /**
2423             * Finds an ordered range of all the blogs stats users.
2424             *
2425             * <p>
2426             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2427             * </p>
2428             *
2429             * @param start the lower bound of the range of blogs stats users to return
2430             * @param end the upper bound of the range of blogs stats users to return (not inclusive)
2431             * @param orderByComparator the comparator to order the results by
2432             * @return the ordered range of blogs stats users
2433             * @throws SystemException if a system exception occurred
2434             */
2435            public List<BlogsStatsUser> findAll(int start, int end,
2436                    OrderByComparator orderByComparator) throws SystemException {
2437                    Object[] finderArgs = new Object[] {
2438                                    String.valueOf(start), String.valueOf(end),
2439                                    String.valueOf(orderByComparator)
2440                            };
2441    
2442                    List<BlogsStatsUser> list = (List<BlogsStatsUser>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2443                                    finderArgs, this);
2444    
2445                    if (list == null) {
2446                            Session session = null;
2447    
2448                            try {
2449                                    session = openSession();
2450    
2451                                    StringBundler query = null;
2452                                    String sql = null;
2453    
2454                                    if (orderByComparator != null) {
2455                                            query = new StringBundler(2 +
2456                                                            (orderByComparator.getOrderByFields().length * 3));
2457    
2458                                            query.append(_SQL_SELECT_BLOGSSTATSUSER);
2459    
2460                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2461                                                    orderByComparator);
2462    
2463                                            sql = query.toString();
2464                                    }
2465                                    else {
2466                                            sql = _SQL_SELECT_BLOGSSTATSUSER.concat(BlogsStatsUserModelImpl.ORDER_BY_JPQL);
2467                                    }
2468    
2469                                    Query q = session.createQuery(sql);
2470    
2471                                    if (orderByComparator == null) {
2472                                            list = (List<BlogsStatsUser>)QueryUtil.list(q,
2473                                                            getDialect(), start, end, false);
2474    
2475                                            Collections.sort(list);
2476                                    }
2477                                    else {
2478                                            list = (List<BlogsStatsUser>)QueryUtil.list(q,
2479                                                            getDialect(), start, end);
2480                                    }
2481                            }
2482                            catch (Exception e) {
2483                                    throw processException(e);
2484                            }
2485                            finally {
2486                                    if (list == null) {
2487                                            list = new ArrayList<BlogsStatsUser>();
2488                                    }
2489    
2490                                    cacheResult(list);
2491    
2492                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2493    
2494                                    closeSession(session);
2495                            }
2496                    }
2497    
2498                    return list;
2499            }
2500    
2501            /**
2502             * Removes all the blogs stats users where groupId = &#63; from the database.
2503             *
2504             * @param groupId the group id to search with
2505             * @throws SystemException if a system exception occurred
2506             */
2507            public void removeByGroupId(long groupId) throws SystemException {
2508                    for (BlogsStatsUser blogsStatsUser : findByGroupId(groupId)) {
2509                            remove(blogsStatsUser);
2510                    }
2511            }
2512    
2513            /**
2514             * Removes all the blogs stats users where userId = &#63; from the database.
2515             *
2516             * @param userId the user id to search with
2517             * @throws SystemException if a system exception occurred
2518             */
2519            public void removeByUserId(long userId) throws SystemException {
2520                    for (BlogsStatsUser blogsStatsUser : findByUserId(userId)) {
2521                            remove(blogsStatsUser);
2522                    }
2523            }
2524    
2525            /**
2526             * Removes the blogs stats user where groupId = &#63; and userId = &#63; from the database.
2527             *
2528             * @param groupId the group id to search with
2529             * @param userId the user id to search with
2530             * @throws SystemException if a system exception occurred
2531             */
2532            public void removeByG_U(long groupId, long userId)
2533                    throws NoSuchStatsUserException, SystemException {
2534                    BlogsStatsUser blogsStatsUser = findByG_U(groupId, userId);
2535    
2536                    remove(blogsStatsUser);
2537            }
2538    
2539            /**
2540             * Removes all the blogs stats users where groupId = &#63; and entryCount &ne; &#63; from the database.
2541             *
2542             * @param groupId the group id to search with
2543             * @param entryCount the entry count to search with
2544             * @throws SystemException if a system exception occurred
2545             */
2546            public void removeByG_NotE(long groupId, int entryCount)
2547                    throws SystemException {
2548                    for (BlogsStatsUser blogsStatsUser : findByG_NotE(groupId, entryCount)) {
2549                            remove(blogsStatsUser);
2550                    }
2551            }
2552    
2553            /**
2554             * Removes all the blogs stats users where companyId = &#63; and entryCount &ne; &#63; from the database.
2555             *
2556             * @param companyId the company id to search with
2557             * @param entryCount the entry count to search with
2558             * @throws SystemException if a system exception occurred
2559             */
2560            public void removeByC_NotE(long companyId, int entryCount)
2561                    throws SystemException {
2562                    for (BlogsStatsUser blogsStatsUser : findByC_NotE(companyId, entryCount)) {
2563                            remove(blogsStatsUser);
2564                    }
2565            }
2566    
2567            /**
2568             * Removes all the blogs stats users where userId = &#63; and lastPostDate = &#63; from the database.
2569             *
2570             * @param userId the user id to search with
2571             * @param lastPostDate the last post date to search with
2572             * @throws SystemException if a system exception occurred
2573             */
2574            public void removeByU_L(long userId, Date lastPostDate)
2575                    throws SystemException {
2576                    for (BlogsStatsUser blogsStatsUser : findByU_L(userId, lastPostDate)) {
2577                            remove(blogsStatsUser);
2578                    }
2579            }
2580    
2581            /**
2582             * Removes all the blogs stats users from the database.
2583             *
2584             * @throws SystemException if a system exception occurred
2585             */
2586            public void removeAll() throws SystemException {
2587                    for (BlogsStatsUser blogsStatsUser : findAll()) {
2588                            remove(blogsStatsUser);
2589                    }
2590            }
2591    
2592            /**
2593             * Counts all the blogs stats users where groupId = &#63;.
2594             *
2595             * @param groupId the group id to search with
2596             * @return the number of matching blogs stats users
2597             * @throws SystemException if a system exception occurred
2598             */
2599            public int countByGroupId(long groupId) throws SystemException {
2600                    Object[] finderArgs = new Object[] { groupId };
2601    
2602                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2603                                    finderArgs, this);
2604    
2605                    if (count == null) {
2606                            Session session = null;
2607    
2608                            try {
2609                                    session = openSession();
2610    
2611                                    StringBundler query = new StringBundler(2);
2612    
2613                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2614    
2615                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2616    
2617                                    String sql = query.toString();
2618    
2619                                    Query q = session.createQuery(sql);
2620    
2621                                    QueryPos qPos = QueryPos.getInstance(q);
2622    
2623                                    qPos.add(groupId);
2624    
2625                                    count = (Long)q.uniqueResult();
2626                            }
2627                            catch (Exception e) {
2628                                    throw processException(e);
2629                            }
2630                            finally {
2631                                    if (count == null) {
2632                                            count = Long.valueOf(0);
2633                                    }
2634    
2635                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2636                                            finderArgs, count);
2637    
2638                                    closeSession(session);
2639                            }
2640                    }
2641    
2642                    return count.intValue();
2643            }
2644    
2645            /**
2646             * Counts all the blogs stats users where userId = &#63;.
2647             *
2648             * @param userId the user id to search with
2649             * @return the number of matching blogs stats users
2650             * @throws SystemException if a system exception occurred
2651             */
2652            public int countByUserId(long userId) throws SystemException {
2653                    Object[] finderArgs = new Object[] { userId };
2654    
2655                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
2656                                    finderArgs, this);
2657    
2658                    if (count == null) {
2659                            Session session = null;
2660    
2661                            try {
2662                                    session = openSession();
2663    
2664                                    StringBundler query = new StringBundler(2);
2665    
2666                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2667    
2668                                    query.append(_FINDER_COLUMN_USERID_USERID_2);
2669    
2670                                    String sql = query.toString();
2671    
2672                                    Query q = session.createQuery(sql);
2673    
2674                                    QueryPos qPos = QueryPos.getInstance(q);
2675    
2676                                    qPos.add(userId);
2677    
2678                                    count = (Long)q.uniqueResult();
2679                            }
2680                            catch (Exception e) {
2681                                    throw processException(e);
2682                            }
2683                            finally {
2684                                    if (count == null) {
2685                                            count = Long.valueOf(0);
2686                                    }
2687    
2688                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
2689                                            finderArgs, count);
2690    
2691                                    closeSession(session);
2692                            }
2693                    }
2694    
2695                    return count.intValue();
2696            }
2697    
2698            /**
2699             * Counts all the blogs stats users where groupId = &#63; and userId = &#63;.
2700             *
2701             * @param groupId the group id to search with
2702             * @param userId the user id to search with
2703             * @return the number of matching blogs stats users
2704             * @throws SystemException if a system exception occurred
2705             */
2706            public int countByG_U(long groupId, long userId) throws SystemException {
2707                    Object[] finderArgs = new Object[] { groupId, userId };
2708    
2709                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
2710                                    finderArgs, this);
2711    
2712                    if (count == null) {
2713                            Session session = null;
2714    
2715                            try {
2716                                    session = openSession();
2717    
2718                                    StringBundler query = new StringBundler(3);
2719    
2720                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2721    
2722                                    query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2723    
2724                                    query.append(_FINDER_COLUMN_G_U_USERID_2);
2725    
2726                                    String sql = query.toString();
2727    
2728                                    Query q = session.createQuery(sql);
2729    
2730                                    QueryPos qPos = QueryPos.getInstance(q);
2731    
2732                                    qPos.add(groupId);
2733    
2734                                    qPos.add(userId);
2735    
2736                                    count = (Long)q.uniqueResult();
2737                            }
2738                            catch (Exception e) {
2739                                    throw processException(e);
2740                            }
2741                            finally {
2742                                    if (count == null) {
2743                                            count = Long.valueOf(0);
2744                                    }
2745    
2746                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
2747                                            count);
2748    
2749                                    closeSession(session);
2750                            }
2751                    }
2752    
2753                    return count.intValue();
2754            }
2755    
2756            /**
2757             * Counts all the blogs stats users where groupId = &#63; and entryCount &ne; &#63;.
2758             *
2759             * @param groupId the group id to search with
2760             * @param entryCount the entry count to search with
2761             * @return the number of matching blogs stats users
2762             * @throws SystemException if a system exception occurred
2763             */
2764            public int countByG_NotE(long groupId, int entryCount)
2765                    throws SystemException {
2766                    Object[] finderArgs = new Object[] { groupId, entryCount };
2767    
2768                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_NOTE,
2769                                    finderArgs, this);
2770    
2771                    if (count == null) {
2772                            Session session = null;
2773    
2774                            try {
2775                                    session = openSession();
2776    
2777                                    StringBundler query = new StringBundler(3);
2778    
2779                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2780    
2781                                    query.append(_FINDER_COLUMN_G_NOTE_GROUPID_2);
2782    
2783                                    query.append(_FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2);
2784    
2785                                    String sql = query.toString();
2786    
2787                                    Query q = session.createQuery(sql);
2788    
2789                                    QueryPos qPos = QueryPos.getInstance(q);
2790    
2791                                    qPos.add(groupId);
2792    
2793                                    qPos.add(entryCount);
2794    
2795                                    count = (Long)q.uniqueResult();
2796                            }
2797                            catch (Exception e) {
2798                                    throw processException(e);
2799                            }
2800                            finally {
2801                                    if (count == null) {
2802                                            count = Long.valueOf(0);
2803                                    }
2804    
2805                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_NOTE,
2806                                            finderArgs, count);
2807    
2808                                    closeSession(session);
2809                            }
2810                    }
2811    
2812                    return count.intValue();
2813            }
2814    
2815            /**
2816             * Counts all the blogs stats users where companyId = &#63; and entryCount &ne; &#63;.
2817             *
2818             * @param companyId the company id to search with
2819             * @param entryCount the entry count to search with
2820             * @return the number of matching blogs stats users
2821             * @throws SystemException if a system exception occurred
2822             */
2823            public int countByC_NotE(long companyId, int entryCount)
2824                    throws SystemException {
2825                    Object[] finderArgs = new Object[] { companyId, entryCount };
2826    
2827                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_NOTE,
2828                                    finderArgs, this);
2829    
2830                    if (count == null) {
2831                            Session session = null;
2832    
2833                            try {
2834                                    session = openSession();
2835    
2836                                    StringBundler query = new StringBundler(3);
2837    
2838                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2839    
2840                                    query.append(_FINDER_COLUMN_C_NOTE_COMPANYID_2);
2841    
2842                                    query.append(_FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2);
2843    
2844                                    String sql = query.toString();
2845    
2846                                    Query q = session.createQuery(sql);
2847    
2848                                    QueryPos qPos = QueryPos.getInstance(q);
2849    
2850                                    qPos.add(companyId);
2851    
2852                                    qPos.add(entryCount);
2853    
2854                                    count = (Long)q.uniqueResult();
2855                            }
2856                            catch (Exception e) {
2857                                    throw processException(e);
2858                            }
2859                            finally {
2860                                    if (count == null) {
2861                                            count = Long.valueOf(0);
2862                                    }
2863    
2864                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_NOTE,
2865                                            finderArgs, count);
2866    
2867                                    closeSession(session);
2868                            }
2869                    }
2870    
2871                    return count.intValue();
2872            }
2873    
2874            /**
2875             * Counts all the blogs stats users where userId = &#63; and lastPostDate = &#63;.
2876             *
2877             * @param userId the user id to search with
2878             * @param lastPostDate the last post date to search with
2879             * @return the number of matching blogs stats users
2880             * @throws SystemException if a system exception occurred
2881             */
2882            public int countByU_L(long userId, Date lastPostDate)
2883                    throws SystemException {
2884                    Object[] finderArgs = new Object[] { userId, lastPostDate };
2885    
2886                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U_L,
2887                                    finderArgs, this);
2888    
2889                    if (count == null) {
2890                            Session session = null;
2891    
2892                            try {
2893                                    session = openSession();
2894    
2895                                    StringBundler query = new StringBundler(3);
2896    
2897                                    query.append(_SQL_COUNT_BLOGSSTATSUSER_WHERE);
2898    
2899                                    query.append(_FINDER_COLUMN_U_L_USERID_2);
2900    
2901                                    if (lastPostDate == null) {
2902                                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_1);
2903                                    }
2904                                    else {
2905                                            query.append(_FINDER_COLUMN_U_L_LASTPOSTDATE_2);
2906                                    }
2907    
2908                                    String sql = query.toString();
2909    
2910                                    Query q = session.createQuery(sql);
2911    
2912                                    QueryPos qPos = QueryPos.getInstance(q);
2913    
2914                                    qPos.add(userId);
2915    
2916                                    if (lastPostDate != null) {
2917                                            qPos.add(CalendarUtil.getTimestamp(lastPostDate));
2918                                    }
2919    
2920                                    count = (Long)q.uniqueResult();
2921                            }
2922                            catch (Exception e) {
2923                                    throw processException(e);
2924                            }
2925                            finally {
2926                                    if (count == null) {
2927                                            count = Long.valueOf(0);
2928                                    }
2929    
2930                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U_L, finderArgs,
2931                                            count);
2932    
2933                                    closeSession(session);
2934                            }
2935                    }
2936    
2937                    return count.intValue();
2938            }
2939    
2940            /**
2941             * Counts all the blogs stats users.
2942             *
2943             * @return the number of blogs stats users
2944             * @throws SystemException if a system exception occurred
2945             */
2946            public int countAll() throws SystemException {
2947                    Object[] finderArgs = new Object[0];
2948    
2949                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2950                                    finderArgs, this);
2951    
2952                    if (count == null) {
2953                            Session session = null;
2954    
2955                            try {
2956                                    session = openSession();
2957    
2958                                    Query q = session.createQuery(_SQL_COUNT_BLOGSSTATSUSER);
2959    
2960                                    count = (Long)q.uniqueResult();
2961                            }
2962                            catch (Exception e) {
2963                                    throw processException(e);
2964                            }
2965                            finally {
2966                                    if (count == null) {
2967                                            count = Long.valueOf(0);
2968                                    }
2969    
2970                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2971                                            count);
2972    
2973                                    closeSession(session);
2974                            }
2975                    }
2976    
2977                    return count.intValue();
2978            }
2979    
2980            /**
2981             * Initializes the blogs stats user persistence.
2982             */
2983            public void afterPropertiesSet() {
2984                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2985                                            com.liferay.portal.util.PropsUtil.get(
2986                                                    "value.object.listener.com.liferay.portlet.blogs.model.BlogsStatsUser")));
2987    
2988                    if (listenerClassNames.length > 0) {
2989                            try {
2990                                    List<ModelListener<BlogsStatsUser>> listenersList = new ArrayList<ModelListener<BlogsStatsUser>>();
2991    
2992                                    for (String listenerClassName : listenerClassNames) {
2993                                            listenersList.add((ModelListener<BlogsStatsUser>)InstanceFactory.newInstance(
2994                                                            listenerClassName));
2995                                    }
2996    
2997                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2998                            }
2999                            catch (Exception e) {
3000                                    _log.error(e);
3001                            }
3002                    }
3003            }
3004    
3005            public void destroy() {
3006                    EntityCacheUtil.removeCache(BlogsStatsUserImpl.class.getName());
3007                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3008                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3009            }
3010    
3011            @BeanReference(type = BlogsEntryPersistence.class)
3012            protected BlogsEntryPersistence blogsEntryPersistence;
3013            @BeanReference(type = BlogsStatsUserPersistence.class)
3014            protected BlogsStatsUserPersistence blogsStatsUserPersistence;
3015            @BeanReference(type = GroupPersistence.class)
3016            protected GroupPersistence groupPersistence;
3017            @BeanReference(type = ResourcePersistence.class)
3018            protected ResourcePersistence resourcePersistence;
3019            @BeanReference(type = UserPersistence.class)
3020            protected UserPersistence userPersistence;
3021            private static final String _SQL_SELECT_BLOGSSTATSUSER = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser";
3022            private static final String _SQL_SELECT_BLOGSSTATSUSER_WHERE = "SELECT blogsStatsUser FROM BlogsStatsUser blogsStatsUser WHERE ";
3023            private static final String _SQL_COUNT_BLOGSSTATSUSER = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser";
3024            private static final String _SQL_COUNT_BLOGSSTATSUSER_WHERE = "SELECT COUNT(blogsStatsUser) FROM BlogsStatsUser blogsStatsUser WHERE ";
3025            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsStatsUser.groupId = ?";
3026            private static final String _FINDER_COLUMN_USERID_USERID_2 = "blogsStatsUser.userId = ?";
3027            private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3028            private static final String _FINDER_COLUMN_G_U_USERID_2 = "blogsStatsUser.userId = ?";
3029            private static final String _FINDER_COLUMN_G_NOTE_GROUPID_2 = "blogsStatsUser.groupId = ? AND ";
3030            private static final String _FINDER_COLUMN_G_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3031            private static final String _FINDER_COLUMN_C_NOTE_COMPANYID_2 = "blogsStatsUser.companyId = ? AND ";
3032            private static final String _FINDER_COLUMN_C_NOTE_ENTRYCOUNT_2 = "blogsStatsUser.entryCount != ?";
3033            private static final String _FINDER_COLUMN_U_L_USERID_2 = "blogsStatsUser.userId = ? AND ";
3034            private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_1 = "blogsStatsUser.lastPostDate IS NULL";
3035            private static final String _FINDER_COLUMN_U_L_LASTPOSTDATE_2 = "blogsStatsUser.lastPostDate = ?";
3036            private static final String _ORDER_BY_ENTITY_ALIAS = "blogsStatsUser.";
3037            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsStatsUser exists with the primary key ";
3038            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsStatsUser exists with the key {";
3039            private static Log _log = LogFactoryUtil.getLog(BlogsStatsUserPersistenceImpl.class);
3040    }