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