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