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