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