001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.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.SQLQuery;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
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.security.permission.InlineSQLHelperUtil;
039    import com.liferay.portal.service.persistence.BatchSessionUtil;
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.shopping.NoSuchCategoryException;
045    import com.liferay.portlet.shopping.model.ShoppingCategory;
046    import com.liferay.portlet.shopping.model.impl.ShoppingCategoryImpl;
047    import com.liferay.portlet.shopping.model.impl.ShoppingCategoryModelImpl;
048    
049    import java.io.Serializable;
050    
051    import java.util.ArrayList;
052    import java.util.Collections;
053    import java.util.List;
054    
055    /**
056     * The persistence implementation for the shopping category service.
057     *
058     * <p>
059     * Never modify or reference this class directly. Always use {@link ShoppingCategoryUtil} to access the shopping category persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
060     * </p>
061     *
062     * <p>
063     * Caching information and settings can be found in <code>portal.properties</code>
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see ShoppingCategoryPersistence
068     * @see ShoppingCategoryUtil
069     * @generated
070     */
071    public class ShoppingCategoryPersistenceImpl extends BasePersistenceImpl<ShoppingCategory>
072            implements ShoppingCategoryPersistence {
073            public static final String FINDER_CLASS_NAME_ENTITY = ShoppingCategoryImpl.class.getName();
074            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
075                    ".List";
076            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
077                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
078                            FINDER_CLASS_NAME_LIST, "findByGroupId",
079                            new String[] {
080                                    Long.class.getName(),
081                                    
082                            "java.lang.Integer", "java.lang.Integer",
083                                    "com.liferay.portal.kernel.util.OrderByComparator"
084                            });
085            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
086                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
087                            FINDER_CLASS_NAME_LIST, "countByGroupId",
088                            new String[] { Long.class.getName() });
089            public static final FinderPath FINDER_PATH_FIND_BY_G_P = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
090                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
091                            FINDER_CLASS_NAME_LIST, "findByG_P",
092                            new String[] {
093                                    Long.class.getName(), Long.class.getName(),
094                                    
095                            "java.lang.Integer", "java.lang.Integer",
096                                    "com.liferay.portal.kernel.util.OrderByComparator"
097                            });
098            public static final FinderPath FINDER_PATH_COUNT_BY_G_P = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
099                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
100                            FINDER_CLASS_NAME_LIST, "countByG_P",
101                            new String[] { Long.class.getName(), Long.class.getName() });
102            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
103                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
104                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
105            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
106                            ShoppingCategoryModelImpl.FINDER_CACHE_ENABLED,
107                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
108    
109            /**
110             * Caches the shopping category in the entity cache if it is enabled.
111             *
112             * @param shoppingCategory the shopping category to cache
113             */
114            public void cacheResult(ShoppingCategory shoppingCategory) {
115                    EntityCacheUtil.putResult(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
116                            ShoppingCategoryImpl.class, shoppingCategory.getPrimaryKey(),
117                            shoppingCategory);
118            }
119    
120            /**
121             * Caches the shopping categories in the entity cache if it is enabled.
122             *
123             * @param shoppingCategories the shopping categories to cache
124             */
125            public void cacheResult(List<ShoppingCategory> shoppingCategories) {
126                    for (ShoppingCategory shoppingCategory : shoppingCategories) {
127                            if (EntityCacheUtil.getResult(
128                                                    ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
129                                                    ShoppingCategoryImpl.class,
130                                                    shoppingCategory.getPrimaryKey(), this) == null) {
131                                    cacheResult(shoppingCategory);
132                            }
133                    }
134            }
135    
136            /**
137             * Clears the cache for all shopping categories.
138             *
139             * <p>
140             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
141             * </p>
142             */
143            public void clearCache() {
144                    CacheRegistryUtil.clear(ShoppingCategoryImpl.class.getName());
145                    EntityCacheUtil.clearCache(ShoppingCategoryImpl.class.getName());
146                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
147                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
148            }
149    
150            /**
151             * Clears the cache for the shopping category.
152             *
153             * <p>
154             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
155             * </p>
156             */
157            public void clearCache(ShoppingCategory shoppingCategory) {
158                    EntityCacheUtil.removeResult(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
159                            ShoppingCategoryImpl.class, shoppingCategory.getPrimaryKey());
160            }
161    
162            /**
163             * Creates a new shopping category with the primary key. Does not add the shopping category to the database.
164             *
165             * @param categoryId the primary key for the new shopping category
166             * @return the new shopping category
167             */
168            public ShoppingCategory create(long categoryId) {
169                    ShoppingCategory shoppingCategory = new ShoppingCategoryImpl();
170    
171                    shoppingCategory.setNew(true);
172                    shoppingCategory.setPrimaryKey(categoryId);
173    
174                    return shoppingCategory;
175            }
176    
177            /**
178             * Removes the shopping category with the primary key from the database. Also notifies the appropriate model listeners.
179             *
180             * @param primaryKey the primary key of the shopping category to remove
181             * @return the shopping category that was removed
182             * @throws com.liferay.portal.NoSuchModelException if a shopping category with the primary key could not be found
183             * @throws SystemException if a system exception occurred
184             */
185            public ShoppingCategory remove(Serializable primaryKey)
186                    throws NoSuchModelException, SystemException {
187                    return remove(((Long)primaryKey).longValue());
188            }
189    
190            /**
191             * Removes the shopping category with the primary key from the database. Also notifies the appropriate model listeners.
192             *
193             * @param categoryId the primary key of the shopping category to remove
194             * @return the shopping category that was removed
195             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a shopping category with the primary key could not be found
196             * @throws SystemException if a system exception occurred
197             */
198            public ShoppingCategory remove(long categoryId)
199                    throws NoSuchCategoryException, SystemException {
200                    Session session = null;
201    
202                    try {
203                            session = openSession();
204    
205                            ShoppingCategory shoppingCategory = (ShoppingCategory)session.get(ShoppingCategoryImpl.class,
206                                            new Long(categoryId));
207    
208                            if (shoppingCategory == null) {
209                                    if (_log.isWarnEnabled()) {
210                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + categoryId);
211                                    }
212    
213                                    throw new NoSuchCategoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
214                                            categoryId);
215                            }
216    
217                            return remove(shoppingCategory);
218                    }
219                    catch (NoSuchCategoryException nsee) {
220                            throw nsee;
221                    }
222                    catch (Exception e) {
223                            throw processException(e);
224                    }
225                    finally {
226                            closeSession(session);
227                    }
228            }
229    
230            protected ShoppingCategory removeImpl(ShoppingCategory shoppingCategory)
231                    throws SystemException {
232                    shoppingCategory = toUnwrappedModel(shoppingCategory);
233    
234                    Session session = null;
235    
236                    try {
237                            session = openSession();
238    
239                            BatchSessionUtil.delete(session, shoppingCategory);
240                    }
241                    catch (Exception e) {
242                            throw processException(e);
243                    }
244                    finally {
245                            closeSession(session);
246                    }
247    
248                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
249    
250                    EntityCacheUtil.removeResult(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
251                            ShoppingCategoryImpl.class, shoppingCategory.getPrimaryKey());
252    
253                    return shoppingCategory;
254            }
255    
256            public ShoppingCategory updateImpl(
257                    com.liferay.portlet.shopping.model.ShoppingCategory shoppingCategory,
258                    boolean merge) throws SystemException {
259                    shoppingCategory = toUnwrappedModel(shoppingCategory);
260    
261                    Session session = null;
262    
263                    try {
264                            session = openSession();
265    
266                            BatchSessionUtil.update(session, shoppingCategory, merge);
267    
268                            shoppingCategory.setNew(false);
269                    }
270                    catch (Exception e) {
271                            throw processException(e);
272                    }
273                    finally {
274                            closeSession(session);
275                    }
276    
277                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
278    
279                    EntityCacheUtil.putResult(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
280                            ShoppingCategoryImpl.class, shoppingCategory.getPrimaryKey(),
281                            shoppingCategory);
282    
283                    return shoppingCategory;
284            }
285    
286            protected ShoppingCategory toUnwrappedModel(
287                    ShoppingCategory shoppingCategory) {
288                    if (shoppingCategory instanceof ShoppingCategoryImpl) {
289                            return shoppingCategory;
290                    }
291    
292                    ShoppingCategoryImpl shoppingCategoryImpl = new ShoppingCategoryImpl();
293    
294                    shoppingCategoryImpl.setNew(shoppingCategory.isNew());
295                    shoppingCategoryImpl.setPrimaryKey(shoppingCategory.getPrimaryKey());
296    
297                    shoppingCategoryImpl.setCategoryId(shoppingCategory.getCategoryId());
298                    shoppingCategoryImpl.setGroupId(shoppingCategory.getGroupId());
299                    shoppingCategoryImpl.setCompanyId(shoppingCategory.getCompanyId());
300                    shoppingCategoryImpl.setUserId(shoppingCategory.getUserId());
301                    shoppingCategoryImpl.setUserName(shoppingCategory.getUserName());
302                    shoppingCategoryImpl.setCreateDate(shoppingCategory.getCreateDate());
303                    shoppingCategoryImpl.setModifiedDate(shoppingCategory.getModifiedDate());
304                    shoppingCategoryImpl.setParentCategoryId(shoppingCategory.getParentCategoryId());
305                    shoppingCategoryImpl.setName(shoppingCategory.getName());
306                    shoppingCategoryImpl.setDescription(shoppingCategory.getDescription());
307    
308                    return shoppingCategoryImpl;
309            }
310    
311            /**
312             * Finds the shopping category with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
313             *
314             * @param primaryKey the primary key of the shopping category to find
315             * @return the shopping category
316             * @throws com.liferay.portal.NoSuchModelException if a shopping category with the primary key could not be found
317             * @throws SystemException if a system exception occurred
318             */
319            public ShoppingCategory findByPrimaryKey(Serializable primaryKey)
320                    throws NoSuchModelException, SystemException {
321                    return findByPrimaryKey(((Long)primaryKey).longValue());
322            }
323    
324            /**
325             * Finds the shopping category with the primary key or throws a {@link com.liferay.portlet.shopping.NoSuchCategoryException} if it could not be found.
326             *
327             * @param categoryId the primary key of the shopping category to find
328             * @return the shopping category
329             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a shopping category with the primary key could not be found
330             * @throws SystemException if a system exception occurred
331             */
332            public ShoppingCategory findByPrimaryKey(long categoryId)
333                    throws NoSuchCategoryException, SystemException {
334                    ShoppingCategory shoppingCategory = fetchByPrimaryKey(categoryId);
335    
336                    if (shoppingCategory == null) {
337                            if (_log.isWarnEnabled()) {
338                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + categoryId);
339                            }
340    
341                            throw new NoSuchCategoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
342                                    categoryId);
343                    }
344    
345                    return shoppingCategory;
346            }
347    
348            /**
349             * Finds the shopping category with the primary key or returns <code>null</code> if it could not be found.
350             *
351             * @param primaryKey the primary key of the shopping category to find
352             * @return the shopping category, or <code>null</code> if a shopping category with the primary key could not be found
353             * @throws SystemException if a system exception occurred
354             */
355            public ShoppingCategory fetchByPrimaryKey(Serializable primaryKey)
356                    throws SystemException {
357                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
358            }
359    
360            /**
361             * Finds the shopping category with the primary key or returns <code>null</code> if it could not be found.
362             *
363             * @param categoryId the primary key of the shopping category to find
364             * @return the shopping category, or <code>null</code> if a shopping category with the primary key could not be found
365             * @throws SystemException if a system exception occurred
366             */
367            public ShoppingCategory fetchByPrimaryKey(long categoryId)
368                    throws SystemException {
369                    ShoppingCategory shoppingCategory = (ShoppingCategory)EntityCacheUtil.getResult(ShoppingCategoryModelImpl.ENTITY_CACHE_ENABLED,
370                                    ShoppingCategoryImpl.class, categoryId, this);
371    
372                    if (shoppingCategory == null) {
373                            Session session = null;
374    
375                            try {
376                                    session = openSession();
377    
378                                    shoppingCategory = (ShoppingCategory)session.get(ShoppingCategoryImpl.class,
379                                                    new Long(categoryId));
380                            }
381                            catch (Exception e) {
382                                    throw processException(e);
383                            }
384                            finally {
385                                    if (shoppingCategory != null) {
386                                            cacheResult(shoppingCategory);
387                                    }
388    
389                                    closeSession(session);
390                            }
391                    }
392    
393                    return shoppingCategory;
394            }
395    
396            /**
397             * Finds all the shopping categories where groupId = &#63;.
398             *
399             * @param groupId the group id to search with
400             * @return the matching shopping categories
401             * @throws SystemException if a system exception occurred
402             */
403            public List<ShoppingCategory> findByGroupId(long groupId)
404                    throws SystemException {
405                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
406            }
407    
408            /**
409             * Finds a range of all the shopping categories where groupId = &#63;.
410             *
411             * <p>
412             * 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.
413             * </p>
414             *
415             * @param groupId the group id to search with
416             * @param start the lower bound of the range of shopping categories to return
417             * @param end the upper bound of the range of shopping categories to return (not inclusive)
418             * @return the range of matching shopping categories
419             * @throws SystemException if a system exception occurred
420             */
421            public List<ShoppingCategory> findByGroupId(long groupId, int start, int end)
422                    throws SystemException {
423                    return findByGroupId(groupId, start, end, null);
424            }
425    
426            /**
427             * Finds an ordered range of all the shopping categories where groupId = &#63;.
428             *
429             * <p>
430             * 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.
431             * </p>
432             *
433             * @param groupId the group id to search with
434             * @param start the lower bound of the range of shopping categories to return
435             * @param end the upper bound of the range of shopping categories to return (not inclusive)
436             * @param orderByComparator the comparator to order the results by
437             * @return the ordered range of matching shopping categories
438             * @throws SystemException if a system exception occurred
439             */
440            public List<ShoppingCategory> findByGroupId(long groupId, int start,
441                    int end, OrderByComparator orderByComparator) throws SystemException {
442                    Object[] finderArgs = new Object[] {
443                                    groupId,
444                                    
445                                    String.valueOf(start), String.valueOf(end),
446                                    String.valueOf(orderByComparator)
447                            };
448    
449                    List<ShoppingCategory> list = (List<ShoppingCategory>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
450                                    finderArgs, this);
451    
452                    if (list == null) {
453                            StringBundler query = null;
454    
455                            if (orderByComparator != null) {
456                                    query = new StringBundler(3 +
457                                                    (orderByComparator.getOrderByFields().length * 3));
458                            }
459                            else {
460                                    query = new StringBundler(3);
461                            }
462    
463                            query.append(_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
464    
465                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
466    
467                            if (orderByComparator != null) {
468                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
469                                            orderByComparator);
470                            }
471    
472                            else {
473                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
474                            }
475    
476                            String sql = query.toString();
477    
478                            Session session = null;
479    
480                            try {
481                                    session = openSession();
482    
483                                    Query q = session.createQuery(sql);
484    
485                                    QueryPos qPos = QueryPos.getInstance(q);
486    
487                                    qPos.add(groupId);
488    
489                                    list = (List<ShoppingCategory>)QueryUtil.list(q, getDialect(),
490                                                    start, end);
491                            }
492                            catch (Exception e) {
493                                    throw processException(e);
494                            }
495                            finally {
496                                    if (list == null) {
497                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
498                                                    finderArgs);
499                                    }
500                                    else {
501                                            cacheResult(list);
502    
503                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
504                                                    finderArgs, list);
505                                    }
506    
507                                    closeSession(session);
508                            }
509                    }
510    
511                    return list;
512            }
513    
514            /**
515             * Finds the first shopping category in the ordered set where groupId = &#63;.
516             *
517             * <p>
518             * 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.
519             * </p>
520             *
521             * @param groupId the group id to search with
522             * @param orderByComparator the comparator to order the set by
523             * @return the first matching shopping category
524             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a matching shopping category could not be found
525             * @throws SystemException if a system exception occurred
526             */
527            public ShoppingCategory findByGroupId_First(long groupId,
528                    OrderByComparator orderByComparator)
529                    throws NoSuchCategoryException, SystemException {
530                    List<ShoppingCategory> list = findByGroupId(groupId, 0, 1,
531                                    orderByComparator);
532    
533                    if (list.isEmpty()) {
534                            StringBundler msg = new StringBundler(4);
535    
536                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
537    
538                            msg.append("groupId=");
539                            msg.append(groupId);
540    
541                            msg.append(StringPool.CLOSE_CURLY_BRACE);
542    
543                            throw new NoSuchCategoryException(msg.toString());
544                    }
545                    else {
546                            return list.get(0);
547                    }
548            }
549    
550            /**
551             * Finds the last shopping category in the ordered set where groupId = &#63;.
552             *
553             * <p>
554             * 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.
555             * </p>
556             *
557             * @param groupId the group id to search with
558             * @param orderByComparator the comparator to order the set by
559             * @return the last matching shopping category
560             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a matching shopping category could not be found
561             * @throws SystemException if a system exception occurred
562             */
563            public ShoppingCategory findByGroupId_Last(long groupId,
564                    OrderByComparator orderByComparator)
565                    throws NoSuchCategoryException, SystemException {
566                    int count = countByGroupId(groupId);
567    
568                    List<ShoppingCategory> list = findByGroupId(groupId, count - 1, count,
569                                    orderByComparator);
570    
571                    if (list.isEmpty()) {
572                            StringBundler msg = new StringBundler(4);
573    
574                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
575    
576                            msg.append("groupId=");
577                            msg.append(groupId);
578    
579                            msg.append(StringPool.CLOSE_CURLY_BRACE);
580    
581                            throw new NoSuchCategoryException(msg.toString());
582                    }
583                    else {
584                            return list.get(0);
585                    }
586            }
587    
588            /**
589             * Finds the shopping categories before and after the current shopping category in the ordered set where groupId = &#63;.
590             *
591             * <p>
592             * 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.
593             * </p>
594             *
595             * @param categoryId the primary key of the current shopping category
596             * @param groupId the group id to search with
597             * @param orderByComparator the comparator to order the set by
598             * @return the previous, current, and next shopping category
599             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a shopping category with the primary key could not be found
600             * @throws SystemException if a system exception occurred
601             */
602            public ShoppingCategory[] findByGroupId_PrevAndNext(long categoryId,
603                    long groupId, OrderByComparator orderByComparator)
604                    throws NoSuchCategoryException, SystemException {
605                    ShoppingCategory shoppingCategory = findByPrimaryKey(categoryId);
606    
607                    Session session = null;
608    
609                    try {
610                            session = openSession();
611    
612                            ShoppingCategory[] array = new ShoppingCategoryImpl[3];
613    
614                            array[0] = getByGroupId_PrevAndNext(session, shoppingCategory,
615                                            groupId, orderByComparator, true);
616    
617                            array[1] = shoppingCategory;
618    
619                            array[2] = getByGroupId_PrevAndNext(session, shoppingCategory,
620                                            groupId, orderByComparator, false);
621    
622                            return array;
623                    }
624                    catch (Exception e) {
625                            throw processException(e);
626                    }
627                    finally {
628                            closeSession(session);
629                    }
630            }
631    
632            protected ShoppingCategory getByGroupId_PrevAndNext(Session session,
633                    ShoppingCategory shoppingCategory, long groupId,
634                    OrderByComparator orderByComparator, boolean previous) {
635                    StringBundler query = null;
636    
637                    if (orderByComparator != null) {
638                            query = new StringBundler(6 +
639                                            (orderByComparator.getOrderByFields().length * 6));
640                    }
641                    else {
642                            query = new StringBundler(3);
643                    }
644    
645                    query.append(_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
646    
647                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
648    
649                    if (orderByComparator != null) {
650                            String[] orderByFields = orderByComparator.getOrderByFields();
651    
652                            if (orderByFields.length > 0) {
653                                    query.append(WHERE_AND);
654                            }
655    
656                            for (int i = 0; i < orderByFields.length; i++) {
657                                    query.append(_ORDER_BY_ENTITY_ALIAS);
658                                    query.append(orderByFields[i]);
659    
660                                    if ((i + 1) < orderByFields.length) {
661                                            if (orderByComparator.isAscending() ^ previous) {
662                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
663                                            }
664                                            else {
665                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
666                                            }
667                                    }
668                                    else {
669                                            if (orderByComparator.isAscending() ^ previous) {
670                                                    query.append(WHERE_GREATER_THAN);
671                                            }
672                                            else {
673                                                    query.append(WHERE_LESSER_THAN);
674                                            }
675                                    }
676                            }
677    
678                            query.append(ORDER_BY_CLAUSE);
679    
680                            for (int i = 0; i < orderByFields.length; i++) {
681                                    query.append(_ORDER_BY_ENTITY_ALIAS);
682                                    query.append(orderByFields[i]);
683    
684                                    if ((i + 1) < orderByFields.length) {
685                                            if (orderByComparator.isAscending() ^ previous) {
686                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
687                                            }
688                                            else {
689                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
690                                            }
691                                    }
692                                    else {
693                                            if (orderByComparator.isAscending() ^ previous) {
694                                                    query.append(ORDER_BY_ASC);
695                                            }
696                                            else {
697                                                    query.append(ORDER_BY_DESC);
698                                            }
699                                    }
700                            }
701                    }
702    
703                    else {
704                            query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
705                    }
706    
707                    String sql = query.toString();
708    
709                    Query q = session.createQuery(sql);
710    
711                    q.setFirstResult(0);
712                    q.setMaxResults(2);
713    
714                    QueryPos qPos = QueryPos.getInstance(q);
715    
716                    qPos.add(groupId);
717    
718                    if (orderByComparator != null) {
719                            Object[] values = orderByComparator.getOrderByValues(shoppingCategory);
720    
721                            for (Object value : values) {
722                                    qPos.add(value);
723                            }
724                    }
725    
726                    List<ShoppingCategory> list = q.list();
727    
728                    if (list.size() == 2) {
729                            return list.get(1);
730                    }
731                    else {
732                            return null;
733                    }
734            }
735    
736            /**
737             * Filters by the user's permissions and finds all the shopping categories where groupId = &#63;.
738             *
739             * @param groupId the group id to search with
740             * @return the matching shopping categories that the user has permission to view
741             * @throws SystemException if a system exception occurred
742             */
743            public List<ShoppingCategory> filterFindByGroupId(long groupId)
744                    throws SystemException {
745                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
746                            QueryUtil.ALL_POS, null);
747            }
748    
749            /**
750             * Filters by the user's permissions and finds a range of all the shopping categories where groupId = &#63;.
751             *
752             * <p>
753             * 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.
754             * </p>
755             *
756             * @param groupId the group id to search with
757             * @param start the lower bound of the range of shopping categories to return
758             * @param end the upper bound of the range of shopping categories to return (not inclusive)
759             * @return the range of matching shopping categories that the user has permission to view
760             * @throws SystemException if a system exception occurred
761             */
762            public List<ShoppingCategory> filterFindByGroupId(long groupId, int start,
763                    int end) throws SystemException {
764                    return filterFindByGroupId(groupId, start, end, null);
765            }
766    
767            /**
768             * Filters by the user's permissions and finds an ordered range of all the shopping categories where groupId = &#63;.
769             *
770             * <p>
771             * 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.
772             * </p>
773             *
774             * @param groupId the group id to search with
775             * @param start the lower bound of the range of shopping categories to return
776             * @param end the upper bound of the range of shopping categories to return (not inclusive)
777             * @param orderByComparator the comparator to order the results by
778             * @return the ordered range of matching shopping categories that the user has permission to view
779             * @throws SystemException if a system exception occurred
780             */
781            public List<ShoppingCategory> filterFindByGroupId(long groupId, int start,
782                    int end, OrderByComparator orderByComparator) throws SystemException {
783                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
784                            return findByGroupId(groupId, start, end, orderByComparator);
785                    }
786    
787                    StringBundler query = null;
788    
789                    if (orderByComparator != null) {
790                            query = new StringBundler(3 +
791                                            (orderByComparator.getOrderByFields().length * 3));
792                    }
793                    else {
794                            query = new StringBundler(3);
795                    }
796    
797                    if (getDB().isSupportsInlineDistinct()) {
798                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
799                    }
800                    else {
801                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_1);
802                    }
803    
804                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
805    
806                    if (!getDB().isSupportsInlineDistinct()) {
807                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_2);
808                    }
809    
810                    if (orderByComparator != null) {
811                            if (getDB().isSupportsInlineDistinct()) {
812                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
813                                            orderByComparator);
814                            }
815                            else {
816                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
817                                            orderByComparator);
818                            }
819                    }
820    
821                    else {
822                            if (getDB().isSupportsInlineDistinct()) {
823                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
824                            }
825                            else {
826                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_SQL);
827                            }
828                    }
829    
830                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
831                                    ShoppingCategory.class.getName(), _FILTER_COLUMN_PK,
832                                    _FILTER_COLUMN_USERID, groupId);
833    
834                    Session session = null;
835    
836                    try {
837                            session = openSession();
838    
839                            SQLQuery q = session.createSQLQuery(sql);
840    
841                            if (getDB().isSupportsInlineDistinct()) {
842                                    q.addEntity(_FILTER_ENTITY_ALIAS, ShoppingCategoryImpl.class);
843                            }
844                            else {
845                                    q.addEntity(_FILTER_ENTITY_TABLE, ShoppingCategoryImpl.class);
846                            }
847    
848                            QueryPos qPos = QueryPos.getInstance(q);
849    
850                            qPos.add(groupId);
851    
852                            return (List<ShoppingCategory>)QueryUtil.list(q, getDialect(),
853                                    start, end);
854                    }
855                    catch (Exception e) {
856                            throw processException(e);
857                    }
858                    finally {
859                            closeSession(session);
860                    }
861            }
862    
863            /**
864             * Finds all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
865             *
866             * @param groupId the group id to search with
867             * @param parentCategoryId the parent category id to search with
868             * @return the matching shopping categories
869             * @throws SystemException if a system exception occurred
870             */
871            public List<ShoppingCategory> findByG_P(long groupId, long parentCategoryId)
872                    throws SystemException {
873                    return findByG_P(groupId, parentCategoryId, QueryUtil.ALL_POS,
874                            QueryUtil.ALL_POS, null);
875            }
876    
877            /**
878             * Finds a range of all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
879             *
880             * <p>
881             * 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.
882             * </p>
883             *
884             * @param groupId the group id to search with
885             * @param parentCategoryId the parent category id to search with
886             * @param start the lower bound of the range of shopping categories to return
887             * @param end the upper bound of the range of shopping categories to return (not inclusive)
888             * @return the range of matching shopping categories
889             * @throws SystemException if a system exception occurred
890             */
891            public List<ShoppingCategory> findByG_P(long groupId,
892                    long parentCategoryId, int start, int end) throws SystemException {
893                    return findByG_P(groupId, parentCategoryId, start, end, null);
894            }
895    
896            /**
897             * Finds an ordered range of all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
898             *
899             * <p>
900             * 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.
901             * </p>
902             *
903             * @param groupId the group id to search with
904             * @param parentCategoryId the parent category id to search with
905             * @param start the lower bound of the range of shopping categories to return
906             * @param end the upper bound of the range of shopping categories to return (not inclusive)
907             * @param orderByComparator the comparator to order the results by
908             * @return the ordered range of matching shopping categories
909             * @throws SystemException if a system exception occurred
910             */
911            public List<ShoppingCategory> findByG_P(long groupId,
912                    long parentCategoryId, int start, int end,
913                    OrderByComparator orderByComparator) throws SystemException {
914                    Object[] finderArgs = new Object[] {
915                                    groupId, parentCategoryId,
916                                    
917                                    String.valueOf(start), String.valueOf(end),
918                                    String.valueOf(orderByComparator)
919                            };
920    
921                    List<ShoppingCategory> list = (List<ShoppingCategory>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P,
922                                    finderArgs, this);
923    
924                    if (list == null) {
925                            StringBundler query = null;
926    
927                            if (orderByComparator != null) {
928                                    query = new StringBundler(4 +
929                                                    (orderByComparator.getOrderByFields().length * 3));
930                            }
931                            else {
932                                    query = new StringBundler(4);
933                            }
934    
935                            query.append(_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
936    
937                            query.append(_FINDER_COLUMN_G_P_GROUPID_2);
938    
939                            query.append(_FINDER_COLUMN_G_P_PARENTCATEGORYID_2);
940    
941                            if (orderByComparator != null) {
942                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
943                                            orderByComparator);
944                            }
945    
946                            else {
947                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
948                            }
949    
950                            String sql = query.toString();
951    
952                            Session session = null;
953    
954                            try {
955                                    session = openSession();
956    
957                                    Query q = session.createQuery(sql);
958    
959                                    QueryPos qPos = QueryPos.getInstance(q);
960    
961                                    qPos.add(groupId);
962    
963                                    qPos.add(parentCategoryId);
964    
965                                    list = (List<ShoppingCategory>)QueryUtil.list(q, getDialect(),
966                                                    start, end);
967                            }
968                            catch (Exception e) {
969                                    throw processException(e);
970                            }
971                            finally {
972                                    if (list == null) {
973                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_P,
974                                                    finderArgs);
975                                    }
976                                    else {
977                                            cacheResult(list);
978    
979                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P,
980                                                    finderArgs, list);
981                                    }
982    
983                                    closeSession(session);
984                            }
985                    }
986    
987                    return list;
988            }
989    
990            /**
991             * Finds the first shopping category in the ordered set where groupId = &#63; and parentCategoryId = &#63;.
992             *
993             * <p>
994             * 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.
995             * </p>
996             *
997             * @param groupId the group id to search with
998             * @param parentCategoryId the parent category id to search with
999             * @param orderByComparator the comparator to order the set by
1000             * @return the first matching shopping category
1001             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a matching shopping category could not be found
1002             * @throws SystemException if a system exception occurred
1003             */
1004            public ShoppingCategory findByG_P_First(long groupId,
1005                    long parentCategoryId, OrderByComparator orderByComparator)
1006                    throws NoSuchCategoryException, SystemException {
1007                    List<ShoppingCategory> list = findByG_P(groupId, parentCategoryId, 0,
1008                                    1, orderByComparator);
1009    
1010                    if (list.isEmpty()) {
1011                            StringBundler msg = new StringBundler(6);
1012    
1013                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1014    
1015                            msg.append("groupId=");
1016                            msg.append(groupId);
1017    
1018                            msg.append(", parentCategoryId=");
1019                            msg.append(parentCategoryId);
1020    
1021                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1022    
1023                            throw new NoSuchCategoryException(msg.toString());
1024                    }
1025                    else {
1026                            return list.get(0);
1027                    }
1028            }
1029    
1030            /**
1031             * Finds the last shopping category in the ordered set where groupId = &#63; and parentCategoryId = &#63;.
1032             *
1033             * <p>
1034             * 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.
1035             * </p>
1036             *
1037             * @param groupId the group id to search with
1038             * @param parentCategoryId the parent category id to search with
1039             * @param orderByComparator the comparator to order the set by
1040             * @return the last matching shopping category
1041             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a matching shopping category could not be found
1042             * @throws SystemException if a system exception occurred
1043             */
1044            public ShoppingCategory findByG_P_Last(long groupId, long parentCategoryId,
1045                    OrderByComparator orderByComparator)
1046                    throws NoSuchCategoryException, SystemException {
1047                    int count = countByG_P(groupId, parentCategoryId);
1048    
1049                    List<ShoppingCategory> list = findByG_P(groupId, parentCategoryId,
1050                                    count - 1, count, orderByComparator);
1051    
1052                    if (list.isEmpty()) {
1053                            StringBundler msg = new StringBundler(6);
1054    
1055                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1056    
1057                            msg.append("groupId=");
1058                            msg.append(groupId);
1059    
1060                            msg.append(", parentCategoryId=");
1061                            msg.append(parentCategoryId);
1062    
1063                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1064    
1065                            throw new NoSuchCategoryException(msg.toString());
1066                    }
1067                    else {
1068                            return list.get(0);
1069                    }
1070            }
1071    
1072            /**
1073             * Finds the shopping categories before and after the current shopping category in the ordered set where groupId = &#63; and parentCategoryId = &#63;.
1074             *
1075             * <p>
1076             * 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.
1077             * </p>
1078             *
1079             * @param categoryId the primary key of the current shopping category
1080             * @param groupId the group id to search with
1081             * @param parentCategoryId the parent category id to search with
1082             * @param orderByComparator the comparator to order the set by
1083             * @return the previous, current, and next shopping category
1084             * @throws com.liferay.portlet.shopping.NoSuchCategoryException if a shopping category with the primary key could not be found
1085             * @throws SystemException if a system exception occurred
1086             */
1087            public ShoppingCategory[] findByG_P_PrevAndNext(long categoryId,
1088                    long groupId, long parentCategoryId, OrderByComparator orderByComparator)
1089                    throws NoSuchCategoryException, SystemException {
1090                    ShoppingCategory shoppingCategory = findByPrimaryKey(categoryId);
1091    
1092                    Session session = null;
1093    
1094                    try {
1095                            session = openSession();
1096    
1097                            ShoppingCategory[] array = new ShoppingCategoryImpl[3];
1098    
1099                            array[0] = getByG_P_PrevAndNext(session, shoppingCategory, groupId,
1100                                            parentCategoryId, orderByComparator, true);
1101    
1102                            array[1] = shoppingCategory;
1103    
1104                            array[2] = getByG_P_PrevAndNext(session, shoppingCategory, groupId,
1105                                            parentCategoryId, orderByComparator, false);
1106    
1107                            return array;
1108                    }
1109                    catch (Exception e) {
1110                            throw processException(e);
1111                    }
1112                    finally {
1113                            closeSession(session);
1114                    }
1115            }
1116    
1117            protected ShoppingCategory getByG_P_PrevAndNext(Session session,
1118                    ShoppingCategory shoppingCategory, long groupId, long parentCategoryId,
1119                    OrderByComparator orderByComparator, boolean previous) {
1120                    StringBundler query = null;
1121    
1122                    if (orderByComparator != null) {
1123                            query = new StringBundler(6 +
1124                                            (orderByComparator.getOrderByFields().length * 6));
1125                    }
1126                    else {
1127                            query = new StringBundler(3);
1128                    }
1129    
1130                    query.append(_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
1131    
1132                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1133    
1134                    query.append(_FINDER_COLUMN_G_P_PARENTCATEGORYID_2);
1135    
1136                    if (orderByComparator != null) {
1137                            String[] orderByFields = orderByComparator.getOrderByFields();
1138    
1139                            if (orderByFields.length > 0) {
1140                                    query.append(WHERE_AND);
1141                            }
1142    
1143                            for (int i = 0; i < orderByFields.length; i++) {
1144                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1145                                    query.append(orderByFields[i]);
1146    
1147                                    if ((i + 1) < orderByFields.length) {
1148                                            if (orderByComparator.isAscending() ^ previous) {
1149                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1150                                            }
1151                                            else {
1152                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1153                                            }
1154                                    }
1155                                    else {
1156                                            if (orderByComparator.isAscending() ^ previous) {
1157                                                    query.append(WHERE_GREATER_THAN);
1158                                            }
1159                                            else {
1160                                                    query.append(WHERE_LESSER_THAN);
1161                                            }
1162                                    }
1163                            }
1164    
1165                            query.append(ORDER_BY_CLAUSE);
1166    
1167                            for (int i = 0; i < orderByFields.length; i++) {
1168                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1169                                    query.append(orderByFields[i]);
1170    
1171                                    if ((i + 1) < orderByFields.length) {
1172                                            if (orderByComparator.isAscending() ^ previous) {
1173                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1174                                            }
1175                                            else {
1176                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1177                                            }
1178                                    }
1179                                    else {
1180                                            if (orderByComparator.isAscending() ^ previous) {
1181                                                    query.append(ORDER_BY_ASC);
1182                                            }
1183                                            else {
1184                                                    query.append(ORDER_BY_DESC);
1185                                            }
1186                                    }
1187                            }
1188                    }
1189    
1190                    else {
1191                            query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
1192                    }
1193    
1194                    String sql = query.toString();
1195    
1196                    Query q = session.createQuery(sql);
1197    
1198                    q.setFirstResult(0);
1199                    q.setMaxResults(2);
1200    
1201                    QueryPos qPos = QueryPos.getInstance(q);
1202    
1203                    qPos.add(groupId);
1204    
1205                    qPos.add(parentCategoryId);
1206    
1207                    if (orderByComparator != null) {
1208                            Object[] values = orderByComparator.getOrderByValues(shoppingCategory);
1209    
1210                            for (Object value : values) {
1211                                    qPos.add(value);
1212                            }
1213                    }
1214    
1215                    List<ShoppingCategory> list = q.list();
1216    
1217                    if (list.size() == 2) {
1218                            return list.get(1);
1219                    }
1220                    else {
1221                            return null;
1222                    }
1223            }
1224    
1225            /**
1226             * Filters by the user's permissions and finds all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
1227             *
1228             * @param groupId the group id to search with
1229             * @param parentCategoryId the parent category id to search with
1230             * @return the matching shopping categories that the user has permission to view
1231             * @throws SystemException if a system exception occurred
1232             */
1233            public List<ShoppingCategory> filterFindByG_P(long groupId,
1234                    long parentCategoryId) throws SystemException {
1235                    return filterFindByG_P(groupId, parentCategoryId, QueryUtil.ALL_POS,
1236                            QueryUtil.ALL_POS, null);
1237            }
1238    
1239            /**
1240             * Filters by the user's permissions and finds a range of all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
1241             *
1242             * <p>
1243             * 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.
1244             * </p>
1245             *
1246             * @param groupId the group id to search with
1247             * @param parentCategoryId the parent category id to search with
1248             * @param start the lower bound of the range of shopping categories to return
1249             * @param end the upper bound of the range of shopping categories to return (not inclusive)
1250             * @return the range of matching shopping categories that the user has permission to view
1251             * @throws SystemException if a system exception occurred
1252             */
1253            public List<ShoppingCategory> filterFindByG_P(long groupId,
1254                    long parentCategoryId, int start, int end) throws SystemException {
1255                    return filterFindByG_P(groupId, parentCategoryId, start, end, null);
1256            }
1257    
1258            /**
1259             * Filters by the user's permissions and finds an ordered range of all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
1260             *
1261             * <p>
1262             * 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.
1263             * </p>
1264             *
1265             * @param groupId the group id to search with
1266             * @param parentCategoryId the parent category id to search with
1267             * @param start the lower bound of the range of shopping categories to return
1268             * @param end the upper bound of the range of shopping categories to return (not inclusive)
1269             * @param orderByComparator the comparator to order the results by
1270             * @return the ordered range of matching shopping categories that the user has permission to view
1271             * @throws SystemException if a system exception occurred
1272             */
1273            public List<ShoppingCategory> filterFindByG_P(long groupId,
1274                    long parentCategoryId, int start, int end,
1275                    OrderByComparator orderByComparator) throws SystemException {
1276                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1277                            return findByG_P(groupId, parentCategoryId, start, end,
1278                                    orderByComparator);
1279                    }
1280    
1281                    StringBundler query = null;
1282    
1283                    if (orderByComparator != null) {
1284                            query = new StringBundler(4 +
1285                                            (orderByComparator.getOrderByFields().length * 3));
1286                    }
1287                    else {
1288                            query = new StringBundler(4);
1289                    }
1290    
1291                    if (getDB().isSupportsInlineDistinct()) {
1292                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_WHERE);
1293                    }
1294                    else {
1295                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_1);
1296                    }
1297    
1298                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1299    
1300                    query.append(_FINDER_COLUMN_G_P_PARENTCATEGORYID_2);
1301    
1302                    if (!getDB().isSupportsInlineDistinct()) {
1303                            query.append(_FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_2);
1304                    }
1305    
1306                    if (orderByComparator != null) {
1307                            if (getDB().isSupportsInlineDistinct()) {
1308                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1309                                            orderByComparator);
1310                            }
1311                            else {
1312                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1313                                            orderByComparator);
1314                            }
1315                    }
1316    
1317                    else {
1318                            if (getDB().isSupportsInlineDistinct()) {
1319                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
1320                            }
1321                            else {
1322                                    query.append(ShoppingCategoryModelImpl.ORDER_BY_SQL);
1323                            }
1324                    }
1325    
1326                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1327                                    ShoppingCategory.class.getName(), _FILTER_COLUMN_PK,
1328                                    _FILTER_COLUMN_USERID, groupId);
1329    
1330                    Session session = null;
1331    
1332                    try {
1333                            session = openSession();
1334    
1335                            SQLQuery q = session.createSQLQuery(sql);
1336    
1337                            if (getDB().isSupportsInlineDistinct()) {
1338                                    q.addEntity(_FILTER_ENTITY_ALIAS, ShoppingCategoryImpl.class);
1339                            }
1340                            else {
1341                                    q.addEntity(_FILTER_ENTITY_TABLE, ShoppingCategoryImpl.class);
1342                            }
1343    
1344                            QueryPos qPos = QueryPos.getInstance(q);
1345    
1346                            qPos.add(groupId);
1347    
1348                            qPos.add(parentCategoryId);
1349    
1350                            return (List<ShoppingCategory>)QueryUtil.list(q, getDialect(),
1351                                    start, end);
1352                    }
1353                    catch (Exception e) {
1354                            throw processException(e);
1355                    }
1356                    finally {
1357                            closeSession(session);
1358                    }
1359            }
1360    
1361            /**
1362             * Finds all the shopping categories.
1363             *
1364             * @return the shopping categories
1365             * @throws SystemException if a system exception occurred
1366             */
1367            public List<ShoppingCategory> findAll() throws SystemException {
1368                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1369            }
1370    
1371            /**
1372             * Finds a range of all the shopping categories.
1373             *
1374             * <p>
1375             * 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.
1376             * </p>
1377             *
1378             * @param start the lower bound of the range of shopping categories to return
1379             * @param end the upper bound of the range of shopping categories to return (not inclusive)
1380             * @return the range of shopping categories
1381             * @throws SystemException if a system exception occurred
1382             */
1383            public List<ShoppingCategory> findAll(int start, int end)
1384                    throws SystemException {
1385                    return findAll(start, end, null);
1386            }
1387    
1388            /**
1389             * Finds an ordered range of all the shopping categories.
1390             *
1391             * <p>
1392             * 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.
1393             * </p>
1394             *
1395             * @param start the lower bound of the range of shopping categories to return
1396             * @param end the upper bound of the range of shopping categories to return (not inclusive)
1397             * @param orderByComparator the comparator to order the results by
1398             * @return the ordered range of shopping categories
1399             * @throws SystemException if a system exception occurred
1400             */
1401            public List<ShoppingCategory> findAll(int start, int end,
1402                    OrderByComparator orderByComparator) throws SystemException {
1403                    Object[] finderArgs = new Object[] {
1404                                    String.valueOf(start), String.valueOf(end),
1405                                    String.valueOf(orderByComparator)
1406                            };
1407    
1408                    List<ShoppingCategory> list = (List<ShoppingCategory>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1409                                    finderArgs, this);
1410    
1411                    if (list == null) {
1412                            StringBundler query = null;
1413                            String sql = null;
1414    
1415                            if (orderByComparator != null) {
1416                                    query = new StringBundler(2 +
1417                                                    (orderByComparator.getOrderByFields().length * 3));
1418    
1419                                    query.append(_SQL_SELECT_SHOPPINGCATEGORY);
1420    
1421                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1422                                            orderByComparator);
1423    
1424                                    sql = query.toString();
1425                            }
1426                            else {
1427                                    sql = _SQL_SELECT_SHOPPINGCATEGORY.concat(ShoppingCategoryModelImpl.ORDER_BY_JPQL);
1428                            }
1429    
1430                            Session session = null;
1431    
1432                            try {
1433                                    session = openSession();
1434    
1435                                    Query q = session.createQuery(sql);
1436    
1437                                    if (orderByComparator == null) {
1438                                            list = (List<ShoppingCategory>)QueryUtil.list(q,
1439                                                            getDialect(), start, end, false);
1440    
1441                                            Collections.sort(list);
1442                                    }
1443                                    else {
1444                                            list = (List<ShoppingCategory>)QueryUtil.list(q,
1445                                                            getDialect(), start, end);
1446                                    }
1447                            }
1448                            catch (Exception e) {
1449                                    throw processException(e);
1450                            }
1451                            finally {
1452                                    if (list == null) {
1453                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1454                                                    finderArgs);
1455                                    }
1456                                    else {
1457                                            cacheResult(list);
1458    
1459                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1460                                                    list);
1461                                    }
1462    
1463                                    closeSession(session);
1464                            }
1465                    }
1466    
1467                    return list;
1468            }
1469    
1470            /**
1471             * Removes all the shopping categories where groupId = &#63; from the database.
1472             *
1473             * @param groupId the group id to search with
1474             * @throws SystemException if a system exception occurred
1475             */
1476            public void removeByGroupId(long groupId) throws SystemException {
1477                    for (ShoppingCategory shoppingCategory : findByGroupId(groupId)) {
1478                            remove(shoppingCategory);
1479                    }
1480            }
1481    
1482            /**
1483             * Removes all the shopping categories where groupId = &#63; and parentCategoryId = &#63; from the database.
1484             *
1485             * @param groupId the group id to search with
1486             * @param parentCategoryId the parent category id to search with
1487             * @throws SystemException if a system exception occurred
1488             */
1489            public void removeByG_P(long groupId, long parentCategoryId)
1490                    throws SystemException {
1491                    for (ShoppingCategory shoppingCategory : findByG_P(groupId,
1492                                    parentCategoryId)) {
1493                            remove(shoppingCategory);
1494                    }
1495            }
1496    
1497            /**
1498             * Removes all the shopping categories from the database.
1499             *
1500             * @throws SystemException if a system exception occurred
1501             */
1502            public void removeAll() throws SystemException {
1503                    for (ShoppingCategory shoppingCategory : findAll()) {
1504                            remove(shoppingCategory);
1505                    }
1506            }
1507    
1508            /**
1509             * Counts all the shopping categories where groupId = &#63;.
1510             *
1511             * @param groupId the group id to search with
1512             * @return the number of matching shopping categories
1513             * @throws SystemException if a system exception occurred
1514             */
1515            public int countByGroupId(long groupId) throws SystemException {
1516                    Object[] finderArgs = new Object[] { groupId };
1517    
1518                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1519                                    finderArgs, this);
1520    
1521                    if (count == null) {
1522                            StringBundler query = new StringBundler(2);
1523    
1524                            query.append(_SQL_COUNT_SHOPPINGCATEGORY_WHERE);
1525    
1526                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1527    
1528                            String sql = query.toString();
1529    
1530                            Session session = null;
1531    
1532                            try {
1533                                    session = openSession();
1534    
1535                                    Query q = session.createQuery(sql);
1536    
1537                                    QueryPos qPos = QueryPos.getInstance(q);
1538    
1539                                    qPos.add(groupId);
1540    
1541                                    count = (Long)q.uniqueResult();
1542                            }
1543                            catch (Exception e) {
1544                                    throw processException(e);
1545                            }
1546                            finally {
1547                                    if (count == null) {
1548                                            count = Long.valueOf(0);
1549                                    }
1550    
1551                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1552                                            finderArgs, count);
1553    
1554                                    closeSession(session);
1555                            }
1556                    }
1557    
1558                    return count.intValue();
1559            }
1560    
1561            /**
1562             * Filters by the user's permissions and counts all the shopping categories where groupId = &#63;.
1563             *
1564             * @param groupId the group id to search with
1565             * @return the number of matching shopping categories that the user has permission to view
1566             * @throws SystemException if a system exception occurred
1567             */
1568            public int filterCountByGroupId(long groupId) throws SystemException {
1569                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1570                            return countByGroupId(groupId);
1571                    }
1572    
1573                    StringBundler query = new StringBundler(2);
1574    
1575                    query.append(_FILTER_SQL_COUNT_SHOPPINGCATEGORY_WHERE);
1576    
1577                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1578    
1579                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1580                                    ShoppingCategory.class.getName(), _FILTER_COLUMN_PK,
1581                                    _FILTER_COLUMN_USERID, groupId);
1582    
1583                    Session session = null;
1584    
1585                    try {
1586                            session = openSession();
1587    
1588                            SQLQuery q = session.createSQLQuery(sql);
1589    
1590                            q.addScalar(COUNT_COLUMN_NAME,
1591                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1592    
1593                            QueryPos qPos = QueryPos.getInstance(q);
1594    
1595                            qPos.add(groupId);
1596    
1597                            Long count = (Long)q.uniqueResult();
1598    
1599                            return count.intValue();
1600                    }
1601                    catch (Exception e) {
1602                            throw processException(e);
1603                    }
1604                    finally {
1605                            closeSession(session);
1606                    }
1607            }
1608    
1609            /**
1610             * Counts all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
1611             *
1612             * @param groupId the group id to search with
1613             * @param parentCategoryId the parent category id to search with
1614             * @return the number of matching shopping categories
1615             * @throws SystemException if a system exception occurred
1616             */
1617            public int countByG_P(long groupId, long parentCategoryId)
1618                    throws SystemException {
1619                    Object[] finderArgs = new Object[] { groupId, parentCategoryId };
1620    
1621                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P,
1622                                    finderArgs, this);
1623    
1624                    if (count == null) {
1625                            StringBundler query = new StringBundler(3);
1626    
1627                            query.append(_SQL_COUNT_SHOPPINGCATEGORY_WHERE);
1628    
1629                            query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1630    
1631                            query.append(_FINDER_COLUMN_G_P_PARENTCATEGORYID_2);
1632    
1633                            String sql = query.toString();
1634    
1635                            Session session = null;
1636    
1637                            try {
1638                                    session = openSession();
1639    
1640                                    Query q = session.createQuery(sql);
1641    
1642                                    QueryPos qPos = QueryPos.getInstance(q);
1643    
1644                                    qPos.add(groupId);
1645    
1646                                    qPos.add(parentCategoryId);
1647    
1648                                    count = (Long)q.uniqueResult();
1649                            }
1650                            catch (Exception e) {
1651                                    throw processException(e);
1652                            }
1653                            finally {
1654                                    if (count == null) {
1655                                            count = Long.valueOf(0);
1656                                    }
1657    
1658                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P, finderArgs,
1659                                            count);
1660    
1661                                    closeSession(session);
1662                            }
1663                    }
1664    
1665                    return count.intValue();
1666            }
1667    
1668            /**
1669             * Filters by the user's permissions and counts all the shopping categories where groupId = &#63; and parentCategoryId = &#63;.
1670             *
1671             * @param groupId the group id to search with
1672             * @param parentCategoryId the parent category id to search with
1673             * @return the number of matching shopping categories that the user has permission to view
1674             * @throws SystemException if a system exception occurred
1675             */
1676            public int filterCountByG_P(long groupId, long parentCategoryId)
1677                    throws SystemException {
1678                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1679                            return countByG_P(groupId, parentCategoryId);
1680                    }
1681    
1682                    StringBundler query = new StringBundler(3);
1683    
1684                    query.append(_FILTER_SQL_COUNT_SHOPPINGCATEGORY_WHERE);
1685    
1686                    query.append(_FINDER_COLUMN_G_P_GROUPID_2);
1687    
1688                    query.append(_FINDER_COLUMN_G_P_PARENTCATEGORYID_2);
1689    
1690                    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1691                                    ShoppingCategory.class.getName(), _FILTER_COLUMN_PK,
1692                                    _FILTER_COLUMN_USERID, groupId);
1693    
1694                    Session session = null;
1695    
1696                    try {
1697                            session = openSession();
1698    
1699                            SQLQuery q = session.createSQLQuery(sql);
1700    
1701                            q.addScalar(COUNT_COLUMN_NAME,
1702                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1703    
1704                            QueryPos qPos = QueryPos.getInstance(q);
1705    
1706                            qPos.add(groupId);
1707    
1708                            qPos.add(parentCategoryId);
1709    
1710                            Long count = (Long)q.uniqueResult();
1711    
1712                            return count.intValue();
1713                    }
1714                    catch (Exception e) {
1715                            throw processException(e);
1716                    }
1717                    finally {
1718                            closeSession(session);
1719                    }
1720            }
1721    
1722            /**
1723             * Counts all the shopping categories.
1724             *
1725             * @return the number of shopping categories
1726             * @throws SystemException if a system exception occurred
1727             */
1728            public int countAll() throws SystemException {
1729                    Object[] finderArgs = new Object[0];
1730    
1731                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1732                                    finderArgs, this);
1733    
1734                    if (count == null) {
1735                            Session session = null;
1736    
1737                            try {
1738                                    session = openSession();
1739    
1740                                    Query q = session.createQuery(_SQL_COUNT_SHOPPINGCATEGORY);
1741    
1742                                    count = (Long)q.uniqueResult();
1743                            }
1744                            catch (Exception e) {
1745                                    throw processException(e);
1746                            }
1747                            finally {
1748                                    if (count == null) {
1749                                            count = Long.valueOf(0);
1750                                    }
1751    
1752                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1753                                            count);
1754    
1755                                    closeSession(session);
1756                            }
1757                    }
1758    
1759                    return count.intValue();
1760            }
1761    
1762            /**
1763             * Initializes the shopping category persistence.
1764             */
1765            public void afterPropertiesSet() {
1766                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1767                                            com.liferay.portal.util.PropsUtil.get(
1768                                                    "value.object.listener.com.liferay.portlet.shopping.model.ShoppingCategory")));
1769    
1770                    if (listenerClassNames.length > 0) {
1771                            try {
1772                                    List<ModelListener<ShoppingCategory>> listenersList = new ArrayList<ModelListener<ShoppingCategory>>();
1773    
1774                                    for (String listenerClassName : listenerClassNames) {
1775                                            listenersList.add((ModelListener<ShoppingCategory>)InstanceFactory.newInstance(
1776                                                            listenerClassName));
1777                                    }
1778    
1779                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1780                            }
1781                            catch (Exception e) {
1782                                    _log.error(e);
1783                            }
1784                    }
1785            }
1786    
1787            public void destroy() {
1788                    EntityCacheUtil.removeCache(ShoppingCategoryImpl.class.getName());
1789                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1790                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1791            }
1792    
1793            @BeanReference(type = ShoppingCartPersistence.class)
1794            protected ShoppingCartPersistence shoppingCartPersistence;
1795            @BeanReference(type = ShoppingCategoryPersistence.class)
1796            protected ShoppingCategoryPersistence shoppingCategoryPersistence;
1797            @BeanReference(type = ShoppingCouponPersistence.class)
1798            protected ShoppingCouponPersistence shoppingCouponPersistence;
1799            @BeanReference(type = ShoppingItemPersistence.class)
1800            protected ShoppingItemPersistence shoppingItemPersistence;
1801            @BeanReference(type = ShoppingItemFieldPersistence.class)
1802            protected ShoppingItemFieldPersistence shoppingItemFieldPersistence;
1803            @BeanReference(type = ShoppingItemPricePersistence.class)
1804            protected ShoppingItemPricePersistence shoppingItemPricePersistence;
1805            @BeanReference(type = ShoppingOrderPersistence.class)
1806            protected ShoppingOrderPersistence shoppingOrderPersistence;
1807            @BeanReference(type = ShoppingOrderItemPersistence.class)
1808            protected ShoppingOrderItemPersistence shoppingOrderItemPersistence;
1809            @BeanReference(type = ResourcePersistence.class)
1810            protected ResourcePersistence resourcePersistence;
1811            @BeanReference(type = UserPersistence.class)
1812            protected UserPersistence userPersistence;
1813            private static final String _SQL_SELECT_SHOPPINGCATEGORY = "SELECT shoppingCategory FROM ShoppingCategory shoppingCategory";
1814            private static final String _SQL_SELECT_SHOPPINGCATEGORY_WHERE = "SELECT shoppingCategory FROM ShoppingCategory shoppingCategory WHERE ";
1815            private static final String _SQL_COUNT_SHOPPINGCATEGORY = "SELECT COUNT(shoppingCategory) FROM ShoppingCategory shoppingCategory";
1816            private static final String _SQL_COUNT_SHOPPINGCATEGORY_WHERE = "SELECT COUNT(shoppingCategory) FROM ShoppingCategory shoppingCategory WHERE ";
1817            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "shoppingCategory.groupId = ?";
1818            private static final String _FINDER_COLUMN_G_P_GROUPID_2 = "shoppingCategory.groupId = ? AND ";
1819            private static final String _FINDER_COLUMN_G_P_PARENTCATEGORYID_2 = "shoppingCategory.parentCategoryId = ?";
1820            private static final String _FILTER_SQL_SELECT_SHOPPINGCATEGORY_WHERE = "SELECT DISTINCT {shoppingCategory.*} FROM ShoppingCategory shoppingCategory WHERE ";
1821            private static final String _FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_1 =
1822                    "SELECT {ShoppingCategory.*} FROM (SELECT DISTINCT shoppingCategory.categoryId FROM ShoppingCategory shoppingCategory WHERE ";
1823            private static final String _FILTER_SQL_SELECT_SHOPPINGCATEGORY_NO_INLINE_DISTINCT_WHERE_2 =
1824                    ") TEMP_TABLE INNER JOIN ShoppingCategory ON TEMP_TABLE.categoryId = ShoppingCategory.categoryId";
1825            private static final String _FILTER_SQL_COUNT_SHOPPINGCATEGORY_WHERE = "SELECT COUNT(DISTINCT shoppingCategory.categoryId) AS COUNT_VALUE FROM ShoppingCategory shoppingCategory WHERE ";
1826            private static final String _FILTER_COLUMN_PK = "shoppingCategory.categoryId";
1827            private static final String _FILTER_COLUMN_USERID = "shoppingCategory.userId";
1828            private static final String _FILTER_ENTITY_ALIAS = "shoppingCategory";
1829            private static final String _FILTER_ENTITY_TABLE = "ShoppingCategory";
1830            private static final String _ORDER_BY_ENTITY_ALIAS = "shoppingCategory.";
1831            private static final String _ORDER_BY_ENTITY_TABLE = "ShoppingCategory.";
1832            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ShoppingCategory exists with the primary key ";
1833            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ShoppingCategory exists with the key {";
1834            private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryPersistenceImpl.class);
1835    }