001    /**
002     * Copyright (c) 2000-2012 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.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchListTypeException;
018    import com.liferay.portal.NoSuchModelException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
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.kernel.util.Validator;
038    import com.liferay.portal.model.CacheModel;
039    import com.liferay.portal.model.ListType;
040    import com.liferay.portal.model.ModelListener;
041    import com.liferay.portal.model.impl.ListTypeImpl;
042    import com.liferay.portal.model.impl.ListTypeModelImpl;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    
051    /**
052     * The persistence implementation for the list type service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see ListTypePersistence
060     * @see ListTypeUtil
061     * @generated
062     */
063    public class ListTypePersistenceImpl extends BasePersistenceImpl<ListType>
064            implements ListTypePersistence {
065            /*
066             * NOTE FOR DEVELOPERS:
067             *
068             * Never modify or reference this class directly. Always use {@link ListTypeUtil} to access the list type persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
069             */
070            public static final String FINDER_CLASS_NAME_ENTITY = ListTypeImpl.class.getName();
071            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List1";
073            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List2";
075            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
076                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByType",
078                            new String[] {
079                                    String.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
085                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
086                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByType",
087                            new String[] { String.class.getName() },
088                            ListTypeModelImpl.TYPE_COLUMN_BITMASK);
089            public static final FinderPath FINDER_PATH_COUNT_BY_TYPE = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
090                            ListTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
091                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByType",
092                            new String[] { String.class.getName() });
093            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
094                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
095                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
096            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
097                            ListTypeModelImpl.FINDER_CACHE_ENABLED, ListTypeImpl.class,
098                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
099            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
100                            ListTypeModelImpl.FINDER_CACHE_ENABLED, Long.class,
101                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
102    
103            /**
104             * Caches the list type in the entity cache if it is enabled.
105             *
106             * @param listType the list type
107             */
108            public void cacheResult(ListType listType) {
109                    EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
110                            ListTypeImpl.class, listType.getPrimaryKey(), listType);
111    
112                    listType.resetOriginalValues();
113            }
114    
115            /**
116             * Caches the list types in the entity cache if it is enabled.
117             *
118             * @param listTypes the list types
119             */
120            public void cacheResult(List<ListType> listTypes) {
121                    for (ListType listType : listTypes) {
122                            if (EntityCacheUtil.getResult(
123                                                    ListTypeModelImpl.ENTITY_CACHE_ENABLED,
124                                                    ListTypeImpl.class, listType.getPrimaryKey()) == null) {
125                                    cacheResult(listType);
126                            }
127                            else {
128                                    listType.resetOriginalValues();
129                            }
130                    }
131            }
132    
133            /**
134             * Clears the cache for all list types.
135             *
136             * <p>
137             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
138             * </p>
139             */
140            @Override
141            public void clearCache() {
142                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
143                            CacheRegistryUtil.clear(ListTypeImpl.class.getName());
144                    }
145    
146                    EntityCacheUtil.clearCache(ListTypeImpl.class.getName());
147    
148                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
149                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
150                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
151            }
152    
153            /**
154             * Clears the cache for the list type.
155             *
156             * <p>
157             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
158             * </p>
159             */
160            @Override
161            public void clearCache(ListType listType) {
162                    EntityCacheUtil.removeResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
163                            ListTypeImpl.class, listType.getPrimaryKey());
164    
165                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
166                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
167            }
168    
169            @Override
170            public void clearCache(List<ListType> listTypes) {
171                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
172                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
173    
174                    for (ListType listType : listTypes) {
175                            EntityCacheUtil.removeResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
176                                    ListTypeImpl.class, listType.getPrimaryKey());
177                    }
178            }
179    
180            /**
181             * Creates a new list type with the primary key. Does not add the list type to the database.
182             *
183             * @param listTypeId the primary key for the new list type
184             * @return the new list type
185             */
186            public ListType create(int listTypeId) {
187                    ListType listType = new ListTypeImpl();
188    
189                    listType.setNew(true);
190                    listType.setPrimaryKey(listTypeId);
191    
192                    return listType;
193            }
194    
195            /**
196             * Removes the list type with the primary key from the database. Also notifies the appropriate model listeners.
197             *
198             * @param listTypeId the primary key of the list type
199             * @return the list type that was removed
200             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
201             * @throws SystemException if a system exception occurred
202             */
203            public ListType remove(int listTypeId)
204                    throws NoSuchListTypeException, SystemException {
205                    return remove(Integer.valueOf(listTypeId));
206            }
207    
208            /**
209             * Removes the list type with the primary key from the database. Also notifies the appropriate model listeners.
210             *
211             * @param primaryKey the primary key of the list type
212             * @return the list type that was removed
213             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
214             * @throws SystemException if a system exception occurred
215             */
216            @Override
217            public ListType remove(Serializable primaryKey)
218                    throws NoSuchListTypeException, SystemException {
219                    Session session = null;
220    
221                    try {
222                            session = openSession();
223    
224                            ListType listType = (ListType)session.get(ListTypeImpl.class,
225                                            primaryKey);
226    
227                            if (listType == null) {
228                                    if (_log.isWarnEnabled()) {
229                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
230                                    }
231    
232                                    throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
233                                            primaryKey);
234                            }
235    
236                            return remove(listType);
237                    }
238                    catch (NoSuchListTypeException nsee) {
239                            throw nsee;
240                    }
241                    catch (Exception e) {
242                            throw processException(e);
243                    }
244                    finally {
245                            closeSession(session);
246                    }
247            }
248    
249            @Override
250            protected ListType removeImpl(ListType listType) throws SystemException {
251                    listType = toUnwrappedModel(listType);
252    
253                    Session session = null;
254    
255                    try {
256                            session = openSession();
257    
258                            if (listType.isCachedModel()) {
259                                    listType = (ListType)session.get(ListTypeImpl.class,
260                                                    listType.getPrimaryKeyObj());
261                            }
262    
263                            session.delete(listType);
264                    }
265                    catch (Exception e) {
266                            throw processException(e);
267                    }
268                    finally {
269                            closeSession(session);
270                    }
271    
272                    clearCache(listType);
273    
274                    return listType;
275            }
276    
277            @Override
278            public ListType updateImpl(com.liferay.portal.model.ListType listType)
279                    throws SystemException {
280                    listType = toUnwrappedModel(listType);
281    
282                    boolean isNew = listType.isNew();
283    
284                    ListTypeModelImpl listTypeModelImpl = (ListTypeModelImpl)listType;
285    
286                    Session session = null;
287    
288                    try {
289                            session = openSession();
290    
291                            if (listType.isNew()) {
292                                    session.save(listType);
293    
294                                    listType.setNew(false);
295                            }
296                            else {
297                                    session.merge(listType);
298                            }
299                    }
300                    catch (Exception e) {
301                            throw processException(e);
302                    }
303                    finally {
304                            closeSession(session);
305                    }
306    
307                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
308    
309                    if (isNew || !ListTypeModelImpl.COLUMN_BITMASK_ENABLED) {
310                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
311                    }
312    
313                    else {
314                            if ((listTypeModelImpl.getColumnBitmask() &
315                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE.getColumnBitmask()) != 0) {
316                                    Object[] args = new Object[] { listTypeModelImpl.getOriginalType() };
317    
318                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
319                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE,
320                                            args);
321    
322                                    args = new Object[] { listTypeModelImpl.getType() };
323    
324                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_TYPE, args);
325                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE,
326                                            args);
327                            }
328                    }
329    
330                    EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
331                            ListTypeImpl.class, listType.getPrimaryKey(), listType);
332    
333                    return listType;
334            }
335    
336            protected ListType toUnwrappedModel(ListType listType) {
337                    if (listType instanceof ListTypeImpl) {
338                            return listType;
339                    }
340    
341                    ListTypeImpl listTypeImpl = new ListTypeImpl();
342    
343                    listTypeImpl.setNew(listType.isNew());
344                    listTypeImpl.setPrimaryKey(listType.getPrimaryKey());
345    
346                    listTypeImpl.setListTypeId(listType.getListTypeId());
347                    listTypeImpl.setName(listType.getName());
348                    listTypeImpl.setType(listType.getType());
349    
350                    return listTypeImpl;
351            }
352    
353            /**
354             * Returns the list type with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
355             *
356             * @param primaryKey the primary key of the list type
357             * @return the list type
358             * @throws com.liferay.portal.NoSuchModelException if a list type with the primary key could not be found
359             * @throws SystemException if a system exception occurred
360             */
361            @Override
362            public ListType findByPrimaryKey(Serializable primaryKey)
363                    throws NoSuchModelException, SystemException {
364                    return findByPrimaryKey(((Integer)primaryKey).intValue());
365            }
366    
367            /**
368             * Returns the list type with the primary key or throws a {@link com.liferay.portal.NoSuchListTypeException} if it could not be found.
369             *
370             * @param listTypeId the primary key of the list type
371             * @return the list type
372             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
373             * @throws SystemException if a system exception occurred
374             */
375            public ListType findByPrimaryKey(int listTypeId)
376                    throws NoSuchListTypeException, SystemException {
377                    ListType listType = fetchByPrimaryKey(listTypeId);
378    
379                    if (listType == null) {
380                            if (_log.isWarnEnabled()) {
381                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + listTypeId);
382                            }
383    
384                            throw new NoSuchListTypeException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
385                                    listTypeId);
386                    }
387    
388                    return listType;
389            }
390    
391            /**
392             * Returns the list type with the primary key or returns <code>null</code> if it could not be found.
393             *
394             * @param primaryKey the primary key of the list type
395             * @return the list type, or <code>null</code> if a list type with the primary key could not be found
396             * @throws SystemException if a system exception occurred
397             */
398            @Override
399            public ListType fetchByPrimaryKey(Serializable primaryKey)
400                    throws SystemException {
401                    return fetchByPrimaryKey(((Integer)primaryKey).intValue());
402            }
403    
404            /**
405             * Returns the list type with the primary key or returns <code>null</code> if it could not be found.
406             *
407             * @param listTypeId the primary key of the list type
408             * @return the list type, or <code>null</code> if a list type with the primary key could not be found
409             * @throws SystemException if a system exception occurred
410             */
411            public ListType fetchByPrimaryKey(int listTypeId) throws SystemException {
412                    ListType listType = (ListType)EntityCacheUtil.getResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
413                                    ListTypeImpl.class, listTypeId);
414    
415                    if (listType == _nullListType) {
416                            return null;
417                    }
418    
419                    if (listType == null) {
420                            Session session = null;
421    
422                            boolean hasException = false;
423    
424                            try {
425                                    session = openSession();
426    
427                                    listType = (ListType)session.get(ListTypeImpl.class,
428                                                    Integer.valueOf(listTypeId));
429                            }
430                            catch (Exception e) {
431                                    hasException = true;
432    
433                                    throw processException(e);
434                            }
435                            finally {
436                                    if (listType != null) {
437                                            cacheResult(listType);
438                                    }
439                                    else if (!hasException) {
440                                            EntityCacheUtil.putResult(ListTypeModelImpl.ENTITY_CACHE_ENABLED,
441                                                    ListTypeImpl.class, listTypeId, _nullListType);
442                                    }
443    
444                                    closeSession(session);
445                            }
446                    }
447    
448                    return listType;
449            }
450    
451            /**
452             * Returns all the list types where type = &#63;.
453             *
454             * @param type the type
455             * @return the matching list types
456             * @throws SystemException if a system exception occurred
457             */
458            public List<ListType> findByType(String type) throws SystemException {
459                    return findByType(type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
460            }
461    
462            /**
463             * Returns a range of all the list types where type = &#63;.
464             *
465             * <p>
466             * 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.
467             * </p>
468             *
469             * @param type the type
470             * @param start the lower bound of the range of list types
471             * @param end the upper bound of the range of list types (not inclusive)
472             * @return the range of matching list types
473             * @throws SystemException if a system exception occurred
474             */
475            public List<ListType> findByType(String type, int start, int end)
476                    throws SystemException {
477                    return findByType(type, start, end, null);
478            }
479    
480            /**
481             * Returns an ordered range of all the list types where type = &#63;.
482             *
483             * <p>
484             * 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.
485             * </p>
486             *
487             * @param type the type
488             * @param start the lower bound of the range of list types
489             * @param end the upper bound of the range of list types (not inclusive)
490             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
491             * @return the ordered range of matching list types
492             * @throws SystemException if a system exception occurred
493             */
494            public List<ListType> findByType(String type, int start, int end,
495                    OrderByComparator orderByComparator) throws SystemException {
496                    FinderPath finderPath = null;
497                    Object[] finderArgs = null;
498    
499                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
500                                    (orderByComparator == null)) {
501                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPE;
502                            finderArgs = new Object[] { type };
503                    }
504                    else {
505                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TYPE;
506                            finderArgs = new Object[] { type, start, end, orderByComparator };
507                    }
508    
509                    List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(finderPath,
510                                    finderArgs, this);
511    
512                    if ((list != null) && !list.isEmpty()) {
513                            for (ListType listType : list) {
514                                    if (!Validator.equals(type, listType.getType())) {
515                                            list = null;
516    
517                                            break;
518                                    }
519                            }
520                    }
521    
522                    if (list == null) {
523                            StringBundler query = null;
524    
525                            if (orderByComparator != null) {
526                                    query = new StringBundler(3 +
527                                                    (orderByComparator.getOrderByFields().length * 3));
528                            }
529                            else {
530                                    query = new StringBundler(3);
531                            }
532    
533                            query.append(_SQL_SELECT_LISTTYPE_WHERE);
534    
535                            if (type == null) {
536                                    query.append(_FINDER_COLUMN_TYPE_TYPE_1);
537                            }
538                            else {
539                                    if (type.equals(StringPool.BLANK)) {
540                                            query.append(_FINDER_COLUMN_TYPE_TYPE_3);
541                                    }
542                                    else {
543                                            query.append(_FINDER_COLUMN_TYPE_TYPE_2);
544                                    }
545                            }
546    
547                            if (orderByComparator != null) {
548                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
549                                            orderByComparator);
550                            }
551    
552                            else {
553                                    query.append(ListTypeModelImpl.ORDER_BY_JPQL);
554                            }
555    
556                            String sql = query.toString();
557    
558                            Session session = null;
559    
560                            try {
561                                    session = openSession();
562    
563                                    Query q = session.createQuery(sql);
564    
565                                    QueryPos qPos = QueryPos.getInstance(q);
566    
567                                    if (type != null) {
568                                            qPos.add(type);
569                                    }
570    
571                                    list = (List<ListType>)QueryUtil.list(q, getDialect(), start,
572                                                    end);
573                            }
574                            catch (Exception e) {
575                                    throw processException(e);
576                            }
577                            finally {
578                                    if (list == null) {
579                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
580                                    }
581                                    else {
582                                            cacheResult(list);
583    
584                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
585                                    }
586    
587                                    closeSession(session);
588                            }
589                    }
590    
591                    return list;
592            }
593    
594            /**
595             * Returns the first list type in the ordered set where type = &#63;.
596             *
597             * @param type the type
598             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
599             * @return the first matching list type
600             * @throws com.liferay.portal.NoSuchListTypeException if a matching list type could not be found
601             * @throws SystemException if a system exception occurred
602             */
603            public ListType findByType_First(String type,
604                    OrderByComparator orderByComparator)
605                    throws NoSuchListTypeException, SystemException {
606                    ListType listType = fetchByType_First(type, orderByComparator);
607    
608                    if (listType != null) {
609                            return listType;
610                    }
611    
612                    StringBundler msg = new StringBundler(4);
613    
614                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
615    
616                    msg.append("type=");
617                    msg.append(type);
618    
619                    msg.append(StringPool.CLOSE_CURLY_BRACE);
620    
621                    throw new NoSuchListTypeException(msg.toString());
622            }
623    
624            /**
625             * Returns the first list type in the ordered set where type = &#63;.
626             *
627             * @param type the type
628             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
629             * @return the first matching list type, or <code>null</code> if a matching list type could not be found
630             * @throws SystemException if a system exception occurred
631             */
632            public ListType fetchByType_First(String type,
633                    OrderByComparator orderByComparator) throws SystemException {
634                    List<ListType> list = findByType(type, 0, 1, orderByComparator);
635    
636                    if (!list.isEmpty()) {
637                            return list.get(0);
638                    }
639    
640                    return null;
641            }
642    
643            /**
644             * Returns the last list type in the ordered set where type = &#63;.
645             *
646             * @param type the type
647             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
648             * @return the last matching list type
649             * @throws com.liferay.portal.NoSuchListTypeException if a matching list type could not be found
650             * @throws SystemException if a system exception occurred
651             */
652            public ListType findByType_Last(String type,
653                    OrderByComparator orderByComparator)
654                    throws NoSuchListTypeException, SystemException {
655                    ListType listType = fetchByType_Last(type, orderByComparator);
656    
657                    if (listType != null) {
658                            return listType;
659                    }
660    
661                    StringBundler msg = new StringBundler(4);
662    
663                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
664    
665                    msg.append("type=");
666                    msg.append(type);
667    
668                    msg.append(StringPool.CLOSE_CURLY_BRACE);
669    
670                    throw new NoSuchListTypeException(msg.toString());
671            }
672    
673            /**
674             * Returns the last list type in the ordered set where type = &#63;.
675             *
676             * @param type the type
677             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
678             * @return the last matching list type, or <code>null</code> if a matching list type could not be found
679             * @throws SystemException if a system exception occurred
680             */
681            public ListType fetchByType_Last(String type,
682                    OrderByComparator orderByComparator) throws SystemException {
683                    int count = countByType(type);
684    
685                    List<ListType> list = findByType(type, count - 1, count,
686                                    orderByComparator);
687    
688                    if (!list.isEmpty()) {
689                            return list.get(0);
690                    }
691    
692                    return null;
693            }
694    
695            /**
696             * Returns the list types before and after the current list type in the ordered set where type = &#63;.
697             *
698             * @param listTypeId the primary key of the current list type
699             * @param type the type
700             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
701             * @return the previous, current, and next list type
702             * @throws com.liferay.portal.NoSuchListTypeException if a list type with the primary key could not be found
703             * @throws SystemException if a system exception occurred
704             */
705            public ListType[] findByType_PrevAndNext(int listTypeId, String type,
706                    OrderByComparator orderByComparator)
707                    throws NoSuchListTypeException, SystemException {
708                    ListType listType = findByPrimaryKey(listTypeId);
709    
710                    Session session = null;
711    
712                    try {
713                            session = openSession();
714    
715                            ListType[] array = new ListTypeImpl[3];
716    
717                            array[0] = getByType_PrevAndNext(session, listType, type,
718                                            orderByComparator, true);
719    
720                            array[1] = listType;
721    
722                            array[2] = getByType_PrevAndNext(session, listType, type,
723                                            orderByComparator, false);
724    
725                            return array;
726                    }
727                    catch (Exception e) {
728                            throw processException(e);
729                    }
730                    finally {
731                            closeSession(session);
732                    }
733            }
734    
735            protected ListType getByType_PrevAndNext(Session session,
736                    ListType listType, String type, OrderByComparator orderByComparator,
737                    boolean previous) {
738                    StringBundler query = null;
739    
740                    if (orderByComparator != null) {
741                            query = new StringBundler(6 +
742                                            (orderByComparator.getOrderByFields().length * 6));
743                    }
744                    else {
745                            query = new StringBundler(3);
746                    }
747    
748                    query.append(_SQL_SELECT_LISTTYPE_WHERE);
749    
750                    if (type == null) {
751                            query.append(_FINDER_COLUMN_TYPE_TYPE_1);
752                    }
753                    else {
754                            if (type.equals(StringPool.BLANK)) {
755                                    query.append(_FINDER_COLUMN_TYPE_TYPE_3);
756                            }
757                            else {
758                                    query.append(_FINDER_COLUMN_TYPE_TYPE_2);
759                            }
760                    }
761    
762                    if (orderByComparator != null) {
763                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
764    
765                            if (orderByConditionFields.length > 0) {
766                                    query.append(WHERE_AND);
767                            }
768    
769                            for (int i = 0; i < orderByConditionFields.length; i++) {
770                                    query.append(_ORDER_BY_ENTITY_ALIAS);
771                                    query.append(orderByConditionFields[i]);
772    
773                                    if ((i + 1) < orderByConditionFields.length) {
774                                            if (orderByComparator.isAscending() ^ previous) {
775                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
776                                            }
777                                            else {
778                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
779                                            }
780                                    }
781                                    else {
782                                            if (orderByComparator.isAscending() ^ previous) {
783                                                    query.append(WHERE_GREATER_THAN);
784                                            }
785                                            else {
786                                                    query.append(WHERE_LESSER_THAN);
787                                            }
788                                    }
789                            }
790    
791                            query.append(ORDER_BY_CLAUSE);
792    
793                            String[] orderByFields = orderByComparator.getOrderByFields();
794    
795                            for (int i = 0; i < orderByFields.length; i++) {
796                                    query.append(_ORDER_BY_ENTITY_ALIAS);
797                                    query.append(orderByFields[i]);
798    
799                                    if ((i + 1) < orderByFields.length) {
800                                            if (orderByComparator.isAscending() ^ previous) {
801                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
802                                            }
803                                            else {
804                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
805                                            }
806                                    }
807                                    else {
808                                            if (orderByComparator.isAscending() ^ previous) {
809                                                    query.append(ORDER_BY_ASC);
810                                            }
811                                            else {
812                                                    query.append(ORDER_BY_DESC);
813                                            }
814                                    }
815                            }
816                    }
817    
818                    else {
819                            query.append(ListTypeModelImpl.ORDER_BY_JPQL);
820                    }
821    
822                    String sql = query.toString();
823    
824                    Query q = session.createQuery(sql);
825    
826                    q.setFirstResult(0);
827                    q.setMaxResults(2);
828    
829                    QueryPos qPos = QueryPos.getInstance(q);
830    
831                    if (type != null) {
832                            qPos.add(type);
833                    }
834    
835                    if (orderByComparator != null) {
836                            Object[] values = orderByComparator.getOrderByConditionValues(listType);
837    
838                            for (Object value : values) {
839                                    qPos.add(value);
840                            }
841                    }
842    
843                    List<ListType> list = q.list();
844    
845                    if (list.size() == 2) {
846                            return list.get(1);
847                    }
848                    else {
849                            return null;
850                    }
851            }
852    
853            /**
854             * Returns all the list types.
855             *
856             * @return the list types
857             * @throws SystemException if a system exception occurred
858             */
859            public List<ListType> findAll() throws SystemException {
860                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
861            }
862    
863            /**
864             * Returns a range of all the list types.
865             *
866             * <p>
867             * 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.
868             * </p>
869             *
870             * @param start the lower bound of the range of list types
871             * @param end the upper bound of the range of list types (not inclusive)
872             * @return the range of list types
873             * @throws SystemException if a system exception occurred
874             */
875            public List<ListType> findAll(int start, int end) throws SystemException {
876                    return findAll(start, end, null);
877            }
878    
879            /**
880             * Returns an ordered range of all the list types.
881             *
882             * <p>
883             * 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.
884             * </p>
885             *
886             * @param start the lower bound of the range of list types
887             * @param end the upper bound of the range of list types (not inclusive)
888             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
889             * @return the ordered range of list types
890             * @throws SystemException if a system exception occurred
891             */
892            public List<ListType> findAll(int start, int end,
893                    OrderByComparator orderByComparator) throws SystemException {
894                    FinderPath finderPath = null;
895                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
896    
897                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
898                                    (orderByComparator == null)) {
899                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
900                            finderArgs = FINDER_ARGS_EMPTY;
901                    }
902                    else {
903                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
904                            finderArgs = new Object[] { start, end, orderByComparator };
905                    }
906    
907                    List<ListType> list = (List<ListType>)FinderCacheUtil.getResult(finderPath,
908                                    finderArgs, this);
909    
910                    if (list == null) {
911                            StringBundler query = null;
912                            String sql = null;
913    
914                            if (orderByComparator != null) {
915                                    query = new StringBundler(2 +
916                                                    (orderByComparator.getOrderByFields().length * 3));
917    
918                                    query.append(_SQL_SELECT_LISTTYPE);
919    
920                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
921                                            orderByComparator);
922    
923                                    sql = query.toString();
924                            }
925                            else {
926                                    sql = _SQL_SELECT_LISTTYPE.concat(ListTypeModelImpl.ORDER_BY_JPQL);
927                            }
928    
929                            Session session = null;
930    
931                            try {
932                                    session = openSession();
933    
934                                    Query q = session.createQuery(sql);
935    
936                                    if (orderByComparator == null) {
937                                            list = (List<ListType>)QueryUtil.list(q, getDialect(),
938                                                            start, end, false);
939    
940                                            Collections.sort(list);
941                                    }
942                                    else {
943                                            list = (List<ListType>)QueryUtil.list(q, getDialect(),
944                                                            start, end);
945                                    }
946                            }
947                            catch (Exception e) {
948                                    throw processException(e);
949                            }
950                            finally {
951                                    if (list == null) {
952                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
953                                    }
954                                    else {
955                                            cacheResult(list);
956    
957                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
958                                    }
959    
960                                    closeSession(session);
961                            }
962                    }
963    
964                    return list;
965            }
966    
967            /**
968             * Removes all the list types where type = &#63; from the database.
969             *
970             * @param type the type
971             * @throws SystemException if a system exception occurred
972             */
973            public void removeByType(String type) throws SystemException {
974                    for (ListType listType : findByType(type)) {
975                            remove(listType);
976                    }
977            }
978    
979            /**
980             * Removes all the list types from the database.
981             *
982             * @throws SystemException if a system exception occurred
983             */
984            public void removeAll() throws SystemException {
985                    for (ListType listType : findAll()) {
986                            remove(listType);
987                    }
988            }
989    
990            /**
991             * Returns the number of list types where type = &#63;.
992             *
993             * @param type the type
994             * @return the number of matching list types
995             * @throws SystemException if a system exception occurred
996             */
997            public int countByType(String type) throws SystemException {
998                    Object[] finderArgs = new Object[] { type };
999    
1000                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TYPE,
1001                                    finderArgs, this);
1002    
1003                    if (count == null) {
1004                            StringBundler query = new StringBundler(2);
1005    
1006                            query.append(_SQL_COUNT_LISTTYPE_WHERE);
1007    
1008                            if (type == null) {
1009                                    query.append(_FINDER_COLUMN_TYPE_TYPE_1);
1010                            }
1011                            else {
1012                                    if (type.equals(StringPool.BLANK)) {
1013                                            query.append(_FINDER_COLUMN_TYPE_TYPE_3);
1014                                    }
1015                                    else {
1016                                            query.append(_FINDER_COLUMN_TYPE_TYPE_2);
1017                                    }
1018                            }
1019    
1020                            String sql = query.toString();
1021    
1022                            Session session = null;
1023    
1024                            try {
1025                                    session = openSession();
1026    
1027                                    Query q = session.createQuery(sql);
1028    
1029                                    QueryPos qPos = QueryPos.getInstance(q);
1030    
1031                                    if (type != null) {
1032                                            qPos.add(type);
1033                                    }
1034    
1035                                    count = (Long)q.uniqueResult();
1036                            }
1037                            catch (Exception e) {
1038                                    throw processException(e);
1039                            }
1040                            finally {
1041                                    if (count == null) {
1042                                            count = Long.valueOf(0);
1043                                    }
1044    
1045                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPE,
1046                                            finderArgs, count);
1047    
1048                                    closeSession(session);
1049                            }
1050                    }
1051    
1052                    return count.intValue();
1053            }
1054    
1055            /**
1056             * Returns the number of list types.
1057             *
1058             * @return the number of list types
1059             * @throws SystemException if a system exception occurred
1060             */
1061            public int countAll() throws SystemException {
1062                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1063                                    FINDER_ARGS_EMPTY, this);
1064    
1065                    if (count == null) {
1066                            Session session = null;
1067    
1068                            try {
1069                                    session = openSession();
1070    
1071                                    Query q = session.createQuery(_SQL_COUNT_LISTTYPE);
1072    
1073                                    count = (Long)q.uniqueResult();
1074                            }
1075                            catch (Exception e) {
1076                                    throw processException(e);
1077                            }
1078                            finally {
1079                                    if (count == null) {
1080                                            count = Long.valueOf(0);
1081                                    }
1082    
1083                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1084                                            FINDER_ARGS_EMPTY, count);
1085    
1086                                    closeSession(session);
1087                            }
1088                    }
1089    
1090                    return count.intValue();
1091            }
1092    
1093            /**
1094             * Initializes the list type persistence.
1095             */
1096            public void afterPropertiesSet() {
1097                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1098                                            com.liferay.portal.util.PropsUtil.get(
1099                                                    "value.object.listener.com.liferay.portal.model.ListType")));
1100    
1101                    if (listenerClassNames.length > 0) {
1102                            try {
1103                                    List<ModelListener<ListType>> listenersList = new ArrayList<ModelListener<ListType>>();
1104    
1105                                    for (String listenerClassName : listenerClassNames) {
1106                                            listenersList.add((ModelListener<ListType>)InstanceFactory.newInstance(
1107                                                            listenerClassName));
1108                                    }
1109    
1110                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1111                            }
1112                            catch (Exception e) {
1113                                    _log.error(e);
1114                            }
1115                    }
1116            }
1117    
1118            public void destroy() {
1119                    EntityCacheUtil.removeCache(ListTypeImpl.class.getName());
1120                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1121                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1122            }
1123    
1124            @BeanReference(type = AccountPersistence.class)
1125            protected AccountPersistence accountPersistence;
1126            @BeanReference(type = AddressPersistence.class)
1127            protected AddressPersistence addressPersistence;
1128            @BeanReference(type = BrowserTrackerPersistence.class)
1129            protected BrowserTrackerPersistence browserTrackerPersistence;
1130            @BeanReference(type = ClassNamePersistence.class)
1131            protected ClassNamePersistence classNamePersistence;
1132            @BeanReference(type = ClusterGroupPersistence.class)
1133            protected ClusterGroupPersistence clusterGroupPersistence;
1134            @BeanReference(type = CompanyPersistence.class)
1135            protected CompanyPersistence companyPersistence;
1136            @BeanReference(type = ContactPersistence.class)
1137            protected ContactPersistence contactPersistence;
1138            @BeanReference(type = CountryPersistence.class)
1139            protected CountryPersistence countryPersistence;
1140            @BeanReference(type = EmailAddressPersistence.class)
1141            protected EmailAddressPersistence emailAddressPersistence;
1142            @BeanReference(type = GroupPersistence.class)
1143            protected GroupPersistence groupPersistence;
1144            @BeanReference(type = ImagePersistence.class)
1145            protected ImagePersistence imagePersistence;
1146            @BeanReference(type = LayoutPersistence.class)
1147            protected LayoutPersistence layoutPersistence;
1148            @BeanReference(type = LayoutBranchPersistence.class)
1149            protected LayoutBranchPersistence layoutBranchPersistence;
1150            @BeanReference(type = LayoutPrototypePersistence.class)
1151            protected LayoutPrototypePersistence layoutPrototypePersistence;
1152            @BeanReference(type = LayoutRevisionPersistence.class)
1153            protected LayoutRevisionPersistence layoutRevisionPersistence;
1154            @BeanReference(type = LayoutSetPersistence.class)
1155            protected LayoutSetPersistence layoutSetPersistence;
1156            @BeanReference(type = LayoutSetBranchPersistence.class)
1157            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1158            @BeanReference(type = LayoutSetPrototypePersistence.class)
1159            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1160            @BeanReference(type = ListTypePersistence.class)
1161            protected ListTypePersistence listTypePersistence;
1162            @BeanReference(type = LockPersistence.class)
1163            protected LockPersistence lockPersistence;
1164            @BeanReference(type = MembershipRequestPersistence.class)
1165            protected MembershipRequestPersistence membershipRequestPersistence;
1166            @BeanReference(type = OrganizationPersistence.class)
1167            protected OrganizationPersistence organizationPersistence;
1168            @BeanReference(type = OrgGroupRolePersistence.class)
1169            protected OrgGroupRolePersistence orgGroupRolePersistence;
1170            @BeanReference(type = OrgLaborPersistence.class)
1171            protected OrgLaborPersistence orgLaborPersistence;
1172            @BeanReference(type = PasswordPolicyPersistence.class)
1173            protected PasswordPolicyPersistence passwordPolicyPersistence;
1174            @BeanReference(type = PasswordPolicyRelPersistence.class)
1175            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1176            @BeanReference(type = PasswordTrackerPersistence.class)
1177            protected PasswordTrackerPersistence passwordTrackerPersistence;
1178            @BeanReference(type = PhonePersistence.class)
1179            protected PhonePersistence phonePersistence;
1180            @BeanReference(type = PluginSettingPersistence.class)
1181            protected PluginSettingPersistence pluginSettingPersistence;
1182            @BeanReference(type = PortalPreferencesPersistence.class)
1183            protected PortalPreferencesPersistence portalPreferencesPersistence;
1184            @BeanReference(type = PortletPersistence.class)
1185            protected PortletPersistence portletPersistence;
1186            @BeanReference(type = PortletItemPersistence.class)
1187            protected PortletItemPersistence portletItemPersistence;
1188            @BeanReference(type = PortletPreferencesPersistence.class)
1189            protected PortletPreferencesPersistence portletPreferencesPersistence;
1190            @BeanReference(type = RegionPersistence.class)
1191            protected RegionPersistence regionPersistence;
1192            @BeanReference(type = ReleasePersistence.class)
1193            protected ReleasePersistence releasePersistence;
1194            @BeanReference(type = RepositoryPersistence.class)
1195            protected RepositoryPersistence repositoryPersistence;
1196            @BeanReference(type = RepositoryEntryPersistence.class)
1197            protected RepositoryEntryPersistence repositoryEntryPersistence;
1198            @BeanReference(type = ResourceActionPersistence.class)
1199            protected ResourceActionPersistence resourceActionPersistence;
1200            @BeanReference(type = ResourceBlockPersistence.class)
1201            protected ResourceBlockPersistence resourceBlockPersistence;
1202            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1203            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1204            @BeanReference(type = ResourcePermissionPersistence.class)
1205            protected ResourcePermissionPersistence resourcePermissionPersistence;
1206            @BeanReference(type = ResourceTypePermissionPersistence.class)
1207            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1208            @BeanReference(type = RolePersistence.class)
1209            protected RolePersistence rolePersistence;
1210            @BeanReference(type = ServiceComponentPersistence.class)
1211            protected ServiceComponentPersistence serviceComponentPersistence;
1212            @BeanReference(type = ShardPersistence.class)
1213            protected ShardPersistence shardPersistence;
1214            @BeanReference(type = SubscriptionPersistence.class)
1215            protected SubscriptionPersistence subscriptionPersistence;
1216            @BeanReference(type = TeamPersistence.class)
1217            protected TeamPersistence teamPersistence;
1218            @BeanReference(type = TicketPersistence.class)
1219            protected TicketPersistence ticketPersistence;
1220            @BeanReference(type = UserPersistence.class)
1221            protected UserPersistence userPersistence;
1222            @BeanReference(type = UserGroupPersistence.class)
1223            protected UserGroupPersistence userGroupPersistence;
1224            @BeanReference(type = UserGroupGroupRolePersistence.class)
1225            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1226            @BeanReference(type = UserGroupRolePersistence.class)
1227            protected UserGroupRolePersistence userGroupRolePersistence;
1228            @BeanReference(type = UserIdMapperPersistence.class)
1229            protected UserIdMapperPersistence userIdMapperPersistence;
1230            @BeanReference(type = UserNotificationEventPersistence.class)
1231            protected UserNotificationEventPersistence userNotificationEventPersistence;
1232            @BeanReference(type = UserTrackerPersistence.class)
1233            protected UserTrackerPersistence userTrackerPersistence;
1234            @BeanReference(type = UserTrackerPathPersistence.class)
1235            protected UserTrackerPathPersistence userTrackerPathPersistence;
1236            @BeanReference(type = VirtualHostPersistence.class)
1237            protected VirtualHostPersistence virtualHostPersistence;
1238            @BeanReference(type = WebDAVPropsPersistence.class)
1239            protected WebDAVPropsPersistence webDAVPropsPersistence;
1240            @BeanReference(type = WebsitePersistence.class)
1241            protected WebsitePersistence websitePersistence;
1242            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1243            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1244            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1245            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1246            private static final String _SQL_SELECT_LISTTYPE = "SELECT listType FROM ListType listType";
1247            private static final String _SQL_SELECT_LISTTYPE_WHERE = "SELECT listType FROM ListType listType WHERE ";
1248            private static final String _SQL_COUNT_LISTTYPE = "SELECT COUNT(listType) FROM ListType listType";
1249            private static final String _SQL_COUNT_LISTTYPE_WHERE = "SELECT COUNT(listType) FROM ListType listType WHERE ";
1250            private static final String _FINDER_COLUMN_TYPE_TYPE_1 = "listType.type IS NULL";
1251            private static final String _FINDER_COLUMN_TYPE_TYPE_2 = "listType.type = ?";
1252            private static final String _FINDER_COLUMN_TYPE_TYPE_3 = "(listType.type IS NULL OR listType.type = ?)";
1253            private static final String _ORDER_BY_ENTITY_ALIAS = "listType.";
1254            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ListType exists with the primary key ";
1255            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ListType exists with the key {";
1256            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1257            private static Log _log = LogFactoryUtil.getLog(ListTypePersistenceImpl.class);
1258            private static ListType _nullListType = new ListTypeImpl() {
1259                            @Override
1260                            public Object clone() {
1261                                    return this;
1262                            }
1263    
1264                            @Override
1265                            public CacheModel<ListType> toCacheModel() {
1266                                    return _nullListTypeCacheModel;
1267                            }
1268                    };
1269    
1270            private static CacheModel<ListType> _nullListTypeCacheModel = new CacheModel<ListType>() {
1271                            public ListType toEntityModel() {
1272                                    return _nullListType;
1273                            }
1274                    };
1275    }