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