1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.messageboards.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
21  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderPath;
23  import com.liferay.portal.kernel.dao.orm.Query;
24  import com.liferay.portal.kernel.dao.orm.QueryPos;
25  import com.liferay.portal.kernel.dao.orm.QueryUtil;
26  import com.liferay.portal.kernel.dao.orm.Session;
27  import com.liferay.portal.kernel.exception.SystemException;
28  import com.liferay.portal.kernel.log.Log;
29  import com.liferay.portal.kernel.log.LogFactoryUtil;
30  import com.liferay.portal.kernel.util.GetterUtil;
31  import com.liferay.portal.kernel.util.OrderByComparator;
32  import com.liferay.portal.kernel.util.StringBundler;
33  import com.liferay.portal.kernel.util.StringPool;
34  import com.liferay.portal.kernel.util.StringUtil;
35  import com.liferay.portal.model.ModelListener;
36  import com.liferay.portal.service.persistence.BatchSessionUtil;
37  import com.liferay.portal.service.persistence.ResourcePersistence;
38  import com.liferay.portal.service.persistence.UserPersistence;
39  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
40  
41  import com.liferay.portlet.messageboards.NoSuchBanException;
42  import com.liferay.portlet.messageboards.model.MBBan;
43  import com.liferay.portlet.messageboards.model.impl.MBBanImpl;
44  import com.liferay.portlet.messageboards.model.impl.MBBanModelImpl;
45  
46  import java.io.Serializable;
47  
48  import java.util.ArrayList;
49  import java.util.Collections;
50  import java.util.List;
51  
52  /**
53   * <a href="MBBanPersistenceImpl.java.html"><b><i>View Source</i></b></a>
54   *
55   * <p>
56   * ServiceBuilder generated this class. Modifications in this class will be
57   * overwritten the next time is generated.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       MBBanPersistence
62   * @see       MBBanUtil
63   * @generated
64   */
65  public class MBBanPersistenceImpl extends BasePersistenceImpl<MBBan>
66      implements MBBanPersistence {
67      public static final String FINDER_CLASS_NAME_ENTITY = MBBanImpl.class.getName();
68      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
69          ".List";
70      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
71              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
72              "findByGroupId", new String[] { Long.class.getName() });
73      public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
74              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
75              "findByGroupId",
76              new String[] {
77                  Long.class.getName(),
78                  
79              "java.lang.Integer", "java.lang.Integer",
80                  "com.liferay.portal.kernel.util.OrderByComparator"
81              });
82      public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
83              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
84              "countByGroupId", new String[] { Long.class.getName() });
85      public static final FinderPath FINDER_PATH_FIND_BY_USERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
86              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
87              "findByUserId", new String[] { Long.class.getName() });
88      public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
89              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
90              "findByUserId",
91              new String[] {
92                  Long.class.getName(),
93                  
94              "java.lang.Integer", "java.lang.Integer",
95                  "com.liferay.portal.kernel.util.OrderByComparator"
96              });
97      public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
98              MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
99              "countByUserId", new String[] { Long.class.getName() });
100     public static final FinderPath FINDER_PATH_FIND_BY_BANUSERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
101             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
102             "findByBanUserId", new String[] { Long.class.getName() });
103     public static final FinderPath FINDER_PATH_FIND_BY_OBC_BANUSERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
104             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105             "findByBanUserId",
106             new String[] {
107                 Long.class.getName(),
108                 
109             "java.lang.Integer", "java.lang.Integer",
110                 "com.liferay.portal.kernel.util.OrderByComparator"
111             });
112     public static final FinderPath FINDER_PATH_COUNT_BY_BANUSERID = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
113             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
114             "countByBanUserId", new String[] { Long.class.getName() });
115     public static final FinderPath FINDER_PATH_FETCH_BY_G_B = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
116             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
117             "fetchByG_B",
118             new String[] { Long.class.getName(), Long.class.getName() });
119     public static final FinderPath FINDER_PATH_COUNT_BY_G_B = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
120             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "countByG_B",
122             new String[] { Long.class.getName(), Long.class.getName() });
123     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
124             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
125             "findAll", new String[0]);
126     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(MBBanModelImpl.ENTITY_CACHE_ENABLED,
127             MBBanModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128             "countAll", new String[0]);
129 
130     public void cacheResult(MBBan mbBan) {
131         EntityCacheUtil.putResult(MBBanModelImpl.ENTITY_CACHE_ENABLED,
132             MBBanImpl.class, mbBan.getPrimaryKey(), mbBan);
133 
134         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_B,
135             new Object[] {
136                 new Long(mbBan.getGroupId()), new Long(mbBan.getBanUserId())
137             }, mbBan);
138     }
139 
140     public void cacheResult(List<MBBan> mbBans) {
141         for (MBBan mbBan : mbBans) {
142             if (EntityCacheUtil.getResult(MBBanModelImpl.ENTITY_CACHE_ENABLED,
143                         MBBanImpl.class, mbBan.getPrimaryKey(), this) == null) {
144                 cacheResult(mbBan);
145             }
146         }
147     }
148 
149     public void clearCache() {
150         CacheRegistry.clear(MBBanImpl.class.getName());
151         EntityCacheUtil.clearCache(MBBanImpl.class.getName());
152         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
153         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
154     }
155 
156     public MBBan create(long banId) {
157         MBBan mbBan = new MBBanImpl();
158 
159         mbBan.setNew(true);
160         mbBan.setPrimaryKey(banId);
161 
162         return mbBan;
163     }
164 
165     public MBBan remove(Serializable primaryKey)
166         throws NoSuchModelException, SystemException {
167         return remove(((Long)primaryKey).longValue());
168     }
169 
170     public MBBan remove(long banId) throws NoSuchBanException, SystemException {
171         Session session = null;
172 
173         try {
174             session = openSession();
175 
176             MBBan mbBan = (MBBan)session.get(MBBanImpl.class, new Long(banId));
177 
178             if (mbBan == null) {
179                 if (_log.isWarnEnabled()) {
180                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + banId);
181                 }
182 
183                 throw new NoSuchBanException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
184                     banId);
185             }
186 
187             return remove(mbBan);
188         }
189         catch (NoSuchBanException nsee) {
190             throw nsee;
191         }
192         catch (Exception e) {
193             throw processException(e);
194         }
195         finally {
196             closeSession(session);
197         }
198     }
199 
200     public MBBan remove(MBBan mbBan) throws SystemException {
201         for (ModelListener<MBBan> listener : listeners) {
202             listener.onBeforeRemove(mbBan);
203         }
204 
205         mbBan = removeImpl(mbBan);
206 
207         for (ModelListener<MBBan> listener : listeners) {
208             listener.onAfterRemove(mbBan);
209         }
210 
211         return mbBan;
212     }
213 
214     protected MBBan removeImpl(MBBan mbBan) throws SystemException {
215         mbBan = toUnwrappedModel(mbBan);
216 
217         Session session = null;
218 
219         try {
220             session = openSession();
221 
222             if (mbBan.isCachedModel() || BatchSessionUtil.isEnabled()) {
223                 Object staleObject = session.get(MBBanImpl.class,
224                         mbBan.getPrimaryKeyObj());
225 
226                 if (staleObject != null) {
227                     session.evict(staleObject);
228                 }
229             }
230 
231             session.delete(mbBan);
232 
233             session.flush();
234         }
235         catch (Exception e) {
236             throw processException(e);
237         }
238         finally {
239             closeSession(session);
240         }
241 
242         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
243 
244         MBBanModelImpl mbBanModelImpl = (MBBanModelImpl)mbBan;
245 
246         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_B,
247             new Object[] {
248                 new Long(mbBanModelImpl.getOriginalGroupId()),
249                 new Long(mbBanModelImpl.getOriginalBanUserId())
250             });
251 
252         EntityCacheUtil.removeResult(MBBanModelImpl.ENTITY_CACHE_ENABLED,
253             MBBanImpl.class, mbBan.getPrimaryKey());
254 
255         return mbBan;
256     }
257 
258     public MBBan updateImpl(
259         com.liferay.portlet.messageboards.model.MBBan mbBan, boolean merge)
260         throws SystemException {
261         mbBan = toUnwrappedModel(mbBan);
262 
263         boolean isNew = mbBan.isNew();
264 
265         MBBanModelImpl mbBanModelImpl = (MBBanModelImpl)mbBan;
266 
267         Session session = null;
268 
269         try {
270             session = openSession();
271 
272             BatchSessionUtil.update(session, mbBan, merge);
273 
274             mbBan.setNew(false);
275         }
276         catch (Exception e) {
277             throw processException(e);
278         }
279         finally {
280             closeSession(session);
281         }
282 
283         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
284 
285         EntityCacheUtil.putResult(MBBanModelImpl.ENTITY_CACHE_ENABLED,
286             MBBanImpl.class, mbBan.getPrimaryKey(), mbBan);
287 
288         if (!isNew &&
289                 ((mbBan.getGroupId() != mbBanModelImpl.getOriginalGroupId()) ||
290                 (mbBan.getBanUserId() != mbBanModelImpl.getOriginalBanUserId()))) {
291             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_B,
292                 new Object[] {
293                     new Long(mbBanModelImpl.getOriginalGroupId()),
294                     new Long(mbBanModelImpl.getOriginalBanUserId())
295                 });
296         }
297 
298         if (isNew ||
299                 ((mbBan.getGroupId() != mbBanModelImpl.getOriginalGroupId()) ||
300                 (mbBan.getBanUserId() != mbBanModelImpl.getOriginalBanUserId()))) {
301             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_B,
302                 new Object[] {
303                     new Long(mbBan.getGroupId()), new Long(mbBan.getBanUserId())
304                 }, mbBan);
305         }
306 
307         return mbBan;
308     }
309 
310     protected MBBan toUnwrappedModel(MBBan mbBan) {
311         if (mbBan instanceof MBBanImpl) {
312             return mbBan;
313         }
314 
315         MBBanImpl mbBanImpl = new MBBanImpl();
316 
317         mbBanImpl.setNew(mbBan.isNew());
318         mbBanImpl.setPrimaryKey(mbBan.getPrimaryKey());
319 
320         mbBanImpl.setBanId(mbBan.getBanId());
321         mbBanImpl.setGroupId(mbBan.getGroupId());
322         mbBanImpl.setCompanyId(mbBan.getCompanyId());
323         mbBanImpl.setUserId(mbBan.getUserId());
324         mbBanImpl.setUserName(mbBan.getUserName());
325         mbBanImpl.setCreateDate(mbBan.getCreateDate());
326         mbBanImpl.setModifiedDate(mbBan.getModifiedDate());
327         mbBanImpl.setBanUserId(mbBan.getBanUserId());
328 
329         return mbBanImpl;
330     }
331 
332     public MBBan findByPrimaryKey(Serializable primaryKey)
333         throws NoSuchModelException, SystemException {
334         return findByPrimaryKey(((Long)primaryKey).longValue());
335     }
336 
337     public MBBan findByPrimaryKey(long banId)
338         throws NoSuchBanException, SystemException {
339         MBBan mbBan = fetchByPrimaryKey(banId);
340 
341         if (mbBan == null) {
342             if (_log.isWarnEnabled()) {
343                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + banId);
344             }
345 
346             throw new NoSuchBanException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
347                 banId);
348         }
349 
350         return mbBan;
351     }
352 
353     public MBBan fetchByPrimaryKey(Serializable primaryKey)
354         throws SystemException {
355         return fetchByPrimaryKey(((Long)primaryKey).longValue());
356     }
357 
358     public MBBan fetchByPrimaryKey(long banId) throws SystemException {
359         MBBan mbBan = (MBBan)EntityCacheUtil.getResult(MBBanModelImpl.ENTITY_CACHE_ENABLED,
360                 MBBanImpl.class, banId, this);
361 
362         if (mbBan == null) {
363             Session session = null;
364 
365             try {
366                 session = openSession();
367 
368                 mbBan = (MBBan)session.get(MBBanImpl.class, new Long(banId));
369             }
370             catch (Exception e) {
371                 throw processException(e);
372             }
373             finally {
374                 if (mbBan != null) {
375                     cacheResult(mbBan);
376                 }
377 
378                 closeSession(session);
379             }
380         }
381 
382         return mbBan;
383     }
384 
385     public List<MBBan> findByGroupId(long groupId) throws SystemException {
386         Object[] finderArgs = new Object[] { new Long(groupId) };
387 
388         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
389                 finderArgs, this);
390 
391         if (list == null) {
392             Session session = null;
393 
394             try {
395                 session = openSession();
396 
397                 StringBundler query = new StringBundler(2);
398 
399                 query.append(_SQL_SELECT_MBBAN_WHERE);
400 
401                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
402 
403                 String sql = query.toString();
404 
405                 Query q = session.createQuery(sql);
406 
407                 QueryPos qPos = QueryPos.getInstance(q);
408 
409                 qPos.add(groupId);
410 
411                 list = q.list();
412             }
413             catch (Exception e) {
414                 throw processException(e);
415             }
416             finally {
417                 if (list == null) {
418                     list = new ArrayList<MBBan>();
419                 }
420 
421                 cacheResult(list);
422 
423                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
424                     finderArgs, list);
425 
426                 closeSession(session);
427             }
428         }
429 
430         return list;
431     }
432 
433     public List<MBBan> findByGroupId(long groupId, int start, int end)
434         throws SystemException {
435         return findByGroupId(groupId, start, end, null);
436     }
437 
438     public List<MBBan> findByGroupId(long groupId, int start, int end,
439         OrderByComparator orderByComparator) throws SystemException {
440         Object[] finderArgs = new Object[] {
441                 new Long(groupId),
442                 
443                 String.valueOf(start), String.valueOf(end),
444                 String.valueOf(orderByComparator)
445             };
446 
447         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
448                 finderArgs, this);
449 
450         if (list == null) {
451             Session session = null;
452 
453             try {
454                 session = openSession();
455 
456                 StringBundler query = null;
457 
458                 if (orderByComparator != null) {
459                     query = new StringBundler(3 +
460                             (orderByComparator.getOrderByFields().length * 3));
461                 }
462                 else {
463                     query = new StringBundler(2);
464                 }
465 
466                 query.append(_SQL_SELECT_MBBAN_WHERE);
467 
468                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
469 
470                 if (orderByComparator != null) {
471                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
472                         orderByComparator);
473                 }
474 
475                 String sql = query.toString();
476 
477                 Query q = session.createQuery(sql);
478 
479                 QueryPos qPos = QueryPos.getInstance(q);
480 
481                 qPos.add(groupId);
482 
483                 list = (List<MBBan>)QueryUtil.list(q, getDialect(), start, end);
484             }
485             catch (Exception e) {
486                 throw processException(e);
487             }
488             finally {
489                 if (list == null) {
490                     list = new ArrayList<MBBan>();
491                 }
492 
493                 cacheResult(list);
494 
495                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
496                     finderArgs, list);
497 
498                 closeSession(session);
499             }
500         }
501 
502         return list;
503     }
504 
505     public MBBan findByGroupId_First(long groupId,
506         OrderByComparator orderByComparator)
507         throws NoSuchBanException, SystemException {
508         List<MBBan> list = findByGroupId(groupId, 0, 1, orderByComparator);
509 
510         if (list.isEmpty()) {
511             StringBundler msg = new StringBundler(4);
512 
513             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
514 
515             msg.append("groupId=");
516             msg.append(groupId);
517 
518             msg.append(StringPool.CLOSE_CURLY_BRACE);
519 
520             throw new NoSuchBanException(msg.toString());
521         }
522         else {
523             return list.get(0);
524         }
525     }
526 
527     public MBBan findByGroupId_Last(long groupId,
528         OrderByComparator orderByComparator)
529         throws NoSuchBanException, SystemException {
530         int count = countByGroupId(groupId);
531 
532         List<MBBan> list = findByGroupId(groupId, count - 1, count,
533                 orderByComparator);
534 
535         if (list.isEmpty()) {
536             StringBundler msg = new StringBundler(4);
537 
538             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
539 
540             msg.append("groupId=");
541             msg.append(groupId);
542 
543             msg.append(StringPool.CLOSE_CURLY_BRACE);
544 
545             throw new NoSuchBanException(msg.toString());
546         }
547         else {
548             return list.get(0);
549         }
550     }
551 
552     public MBBan[] findByGroupId_PrevAndNext(long banId, long groupId,
553         OrderByComparator orderByComparator)
554         throws NoSuchBanException, SystemException {
555         MBBan mbBan = findByPrimaryKey(banId);
556 
557         int count = countByGroupId(groupId);
558 
559         Session session = null;
560 
561         try {
562             session = openSession();
563 
564             StringBundler query = null;
565 
566             if (orderByComparator != null) {
567                 query = new StringBundler(3 +
568                         (orderByComparator.getOrderByFields().length * 3));
569             }
570             else {
571                 query = new StringBundler(2);
572             }
573 
574             query.append(_SQL_SELECT_MBBAN_WHERE);
575 
576             query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
577 
578             if (orderByComparator != null) {
579                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
580                     orderByComparator);
581             }
582 
583             String sql = query.toString();
584 
585             Query q = session.createQuery(sql);
586 
587             QueryPos qPos = QueryPos.getInstance(q);
588 
589             qPos.add(groupId);
590 
591             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
592                     orderByComparator, mbBan);
593 
594             MBBan[] array = new MBBanImpl[3];
595 
596             array[0] = (MBBan)objArray[0];
597             array[1] = (MBBan)objArray[1];
598             array[2] = (MBBan)objArray[2];
599 
600             return array;
601         }
602         catch (Exception e) {
603             throw processException(e);
604         }
605         finally {
606             closeSession(session);
607         }
608     }
609 
610     public List<MBBan> findByUserId(long userId) throws SystemException {
611         Object[] finderArgs = new Object[] { new Long(userId) };
612 
613         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID,
614                 finderArgs, this);
615 
616         if (list == null) {
617             Session session = null;
618 
619             try {
620                 session = openSession();
621 
622                 StringBundler query = new StringBundler(2);
623 
624                 query.append(_SQL_SELECT_MBBAN_WHERE);
625 
626                 query.append(_FINDER_COLUMN_USERID_USERID_2);
627 
628                 String sql = query.toString();
629 
630                 Query q = session.createQuery(sql);
631 
632                 QueryPos qPos = QueryPos.getInstance(q);
633 
634                 qPos.add(userId);
635 
636                 list = q.list();
637             }
638             catch (Exception e) {
639                 throw processException(e);
640             }
641             finally {
642                 if (list == null) {
643                     list = new ArrayList<MBBan>();
644                 }
645 
646                 cacheResult(list);
647 
648                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID,
649                     finderArgs, list);
650 
651                 closeSession(session);
652             }
653         }
654 
655         return list;
656     }
657 
658     public List<MBBan> findByUserId(long userId, int start, int end)
659         throws SystemException {
660         return findByUserId(userId, start, end, null);
661     }
662 
663     public List<MBBan> findByUserId(long userId, int start, int end,
664         OrderByComparator orderByComparator) throws SystemException {
665         Object[] finderArgs = new Object[] {
666                 new Long(userId),
667                 
668                 String.valueOf(start), String.valueOf(end),
669                 String.valueOf(orderByComparator)
670             };
671 
672         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID,
673                 finderArgs, this);
674 
675         if (list == null) {
676             Session session = null;
677 
678             try {
679                 session = openSession();
680 
681                 StringBundler query = null;
682 
683                 if (orderByComparator != null) {
684                     query = new StringBundler(3 +
685                             (orderByComparator.getOrderByFields().length * 3));
686                 }
687                 else {
688                     query = new StringBundler(2);
689                 }
690 
691                 query.append(_SQL_SELECT_MBBAN_WHERE);
692 
693                 query.append(_FINDER_COLUMN_USERID_USERID_2);
694 
695                 if (orderByComparator != null) {
696                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
697                         orderByComparator);
698                 }
699 
700                 String sql = query.toString();
701 
702                 Query q = session.createQuery(sql);
703 
704                 QueryPos qPos = QueryPos.getInstance(q);
705 
706                 qPos.add(userId);
707 
708                 list = (List<MBBan>)QueryUtil.list(q, getDialect(), start, end);
709             }
710             catch (Exception e) {
711                 throw processException(e);
712             }
713             finally {
714                 if (list == null) {
715                     list = new ArrayList<MBBan>();
716                 }
717 
718                 cacheResult(list);
719 
720                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID,
721                     finderArgs, list);
722 
723                 closeSession(session);
724             }
725         }
726 
727         return list;
728     }
729 
730     public MBBan findByUserId_First(long userId,
731         OrderByComparator orderByComparator)
732         throws NoSuchBanException, SystemException {
733         List<MBBan> list = findByUserId(userId, 0, 1, orderByComparator);
734 
735         if (list.isEmpty()) {
736             StringBundler msg = new StringBundler(4);
737 
738             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
739 
740             msg.append("userId=");
741             msg.append(userId);
742 
743             msg.append(StringPool.CLOSE_CURLY_BRACE);
744 
745             throw new NoSuchBanException(msg.toString());
746         }
747         else {
748             return list.get(0);
749         }
750     }
751 
752     public MBBan findByUserId_Last(long userId,
753         OrderByComparator orderByComparator)
754         throws NoSuchBanException, SystemException {
755         int count = countByUserId(userId);
756 
757         List<MBBan> list = findByUserId(userId, count - 1, count,
758                 orderByComparator);
759 
760         if (list.isEmpty()) {
761             StringBundler msg = new StringBundler(4);
762 
763             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
764 
765             msg.append("userId=");
766             msg.append(userId);
767 
768             msg.append(StringPool.CLOSE_CURLY_BRACE);
769 
770             throw new NoSuchBanException(msg.toString());
771         }
772         else {
773             return list.get(0);
774         }
775     }
776 
777     public MBBan[] findByUserId_PrevAndNext(long banId, long userId,
778         OrderByComparator orderByComparator)
779         throws NoSuchBanException, SystemException {
780         MBBan mbBan = findByPrimaryKey(banId);
781 
782         int count = countByUserId(userId);
783 
784         Session session = null;
785 
786         try {
787             session = openSession();
788 
789             StringBundler query = null;
790 
791             if (orderByComparator != null) {
792                 query = new StringBundler(3 +
793                         (orderByComparator.getOrderByFields().length * 3));
794             }
795             else {
796                 query = new StringBundler(2);
797             }
798 
799             query.append(_SQL_SELECT_MBBAN_WHERE);
800 
801             query.append(_FINDER_COLUMN_USERID_USERID_2);
802 
803             if (orderByComparator != null) {
804                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
805                     orderByComparator);
806             }
807 
808             String sql = query.toString();
809 
810             Query q = session.createQuery(sql);
811 
812             QueryPos qPos = QueryPos.getInstance(q);
813 
814             qPos.add(userId);
815 
816             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
817                     orderByComparator, mbBan);
818 
819             MBBan[] array = new MBBanImpl[3];
820 
821             array[0] = (MBBan)objArray[0];
822             array[1] = (MBBan)objArray[1];
823             array[2] = (MBBan)objArray[2];
824 
825             return array;
826         }
827         catch (Exception e) {
828             throw processException(e);
829         }
830         finally {
831             closeSession(session);
832         }
833     }
834 
835     public List<MBBan> findByBanUserId(long banUserId)
836         throws SystemException {
837         Object[] finderArgs = new Object[] { new Long(banUserId) };
838 
839         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_BANUSERID,
840                 finderArgs, this);
841 
842         if (list == null) {
843             Session session = null;
844 
845             try {
846                 session = openSession();
847 
848                 StringBundler query = new StringBundler(2);
849 
850                 query.append(_SQL_SELECT_MBBAN_WHERE);
851 
852                 query.append(_FINDER_COLUMN_BANUSERID_BANUSERID_2);
853 
854                 String sql = query.toString();
855 
856                 Query q = session.createQuery(sql);
857 
858                 QueryPos qPos = QueryPos.getInstance(q);
859 
860                 qPos.add(banUserId);
861 
862                 list = q.list();
863             }
864             catch (Exception e) {
865                 throw processException(e);
866             }
867             finally {
868                 if (list == null) {
869                     list = new ArrayList<MBBan>();
870                 }
871 
872                 cacheResult(list);
873 
874                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_BANUSERID,
875                     finderArgs, list);
876 
877                 closeSession(session);
878             }
879         }
880 
881         return list;
882     }
883 
884     public List<MBBan> findByBanUserId(long banUserId, int start, int end)
885         throws SystemException {
886         return findByBanUserId(banUserId, start, end, null);
887     }
888 
889     public List<MBBan> findByBanUserId(long banUserId, int start, int end,
890         OrderByComparator orderByComparator) throws SystemException {
891         Object[] finderArgs = new Object[] {
892                 new Long(banUserId),
893                 
894                 String.valueOf(start), String.valueOf(end),
895                 String.valueOf(orderByComparator)
896             };
897 
898         List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_BANUSERID,
899                 finderArgs, this);
900 
901         if (list == null) {
902             Session session = null;
903 
904             try {
905                 session = openSession();
906 
907                 StringBundler query = null;
908 
909                 if (orderByComparator != null) {
910                     query = new StringBundler(3 +
911                             (orderByComparator.getOrderByFields().length * 3));
912                 }
913                 else {
914                     query = new StringBundler(2);
915                 }
916 
917                 query.append(_SQL_SELECT_MBBAN_WHERE);
918 
919                 query.append(_FINDER_COLUMN_BANUSERID_BANUSERID_2);
920 
921                 if (orderByComparator != null) {
922                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
923                         orderByComparator);
924                 }
925 
926                 String sql = query.toString();
927 
928                 Query q = session.createQuery(sql);
929 
930                 QueryPos qPos = QueryPos.getInstance(q);
931 
932                 qPos.add(banUserId);
933 
934                 list = (List<MBBan>)QueryUtil.list(q, getDialect(), start, end);
935             }
936             catch (Exception e) {
937                 throw processException(e);
938             }
939             finally {
940                 if (list == null) {
941                     list = new ArrayList<MBBan>();
942                 }
943 
944                 cacheResult(list);
945 
946                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_BANUSERID,
947                     finderArgs, list);
948 
949                 closeSession(session);
950             }
951         }
952 
953         return list;
954     }
955 
956     public MBBan findByBanUserId_First(long banUserId,
957         OrderByComparator orderByComparator)
958         throws NoSuchBanException, SystemException {
959         List<MBBan> list = findByBanUserId(banUserId, 0, 1, orderByComparator);
960 
961         if (list.isEmpty()) {
962             StringBundler msg = new StringBundler(4);
963 
964             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
965 
966             msg.append("banUserId=");
967             msg.append(banUserId);
968 
969             msg.append(StringPool.CLOSE_CURLY_BRACE);
970 
971             throw new NoSuchBanException(msg.toString());
972         }
973         else {
974             return list.get(0);
975         }
976     }
977 
978     public MBBan findByBanUserId_Last(long banUserId,
979         OrderByComparator orderByComparator)
980         throws NoSuchBanException, SystemException {
981         int count = countByBanUserId(banUserId);
982 
983         List<MBBan> list = findByBanUserId(banUserId, count - 1, count,
984                 orderByComparator);
985 
986         if (list.isEmpty()) {
987             StringBundler msg = new StringBundler(4);
988 
989             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
990 
991             msg.append("banUserId=");
992             msg.append(banUserId);
993 
994             msg.append(StringPool.CLOSE_CURLY_BRACE);
995 
996             throw new NoSuchBanException(msg.toString());
997         }
998         else {
999             return list.get(0);
1000        }
1001    }
1002
1003    public MBBan[] findByBanUserId_PrevAndNext(long banId, long banUserId,
1004        OrderByComparator orderByComparator)
1005        throws NoSuchBanException, SystemException {
1006        MBBan mbBan = findByPrimaryKey(banId);
1007
1008        int count = countByBanUserId(banUserId);
1009
1010        Session session = null;
1011
1012        try {
1013            session = openSession();
1014
1015            StringBundler query = null;
1016
1017            if (orderByComparator != null) {
1018                query = new StringBundler(3 +
1019                        (orderByComparator.getOrderByFields().length * 3));
1020            }
1021            else {
1022                query = new StringBundler(2);
1023            }
1024
1025            query.append(_SQL_SELECT_MBBAN_WHERE);
1026
1027            query.append(_FINDER_COLUMN_BANUSERID_BANUSERID_2);
1028
1029            if (orderByComparator != null) {
1030                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1031                    orderByComparator);
1032            }
1033
1034            String sql = query.toString();
1035
1036            Query q = session.createQuery(sql);
1037
1038            QueryPos qPos = QueryPos.getInstance(q);
1039
1040            qPos.add(banUserId);
1041
1042            Object[] objArray = QueryUtil.getPrevAndNext(q, count,
1043                    orderByComparator, mbBan);
1044
1045            MBBan[] array = new MBBanImpl[3];
1046
1047            array[0] = (MBBan)objArray[0];
1048            array[1] = (MBBan)objArray[1];
1049            array[2] = (MBBan)objArray[2];
1050
1051            return array;
1052        }
1053        catch (Exception e) {
1054            throw processException(e);
1055        }
1056        finally {
1057            closeSession(session);
1058        }
1059    }
1060
1061    public MBBan findByG_B(long groupId, long banUserId)
1062        throws NoSuchBanException, SystemException {
1063        MBBan mbBan = fetchByG_B(groupId, banUserId);
1064
1065        if (mbBan == null) {
1066            StringBundler msg = new StringBundler(6);
1067
1068            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1069
1070            msg.append("groupId=");
1071            msg.append(groupId);
1072
1073            msg.append(", banUserId=");
1074            msg.append(banUserId);
1075
1076            msg.append(StringPool.CLOSE_CURLY_BRACE);
1077
1078            if (_log.isWarnEnabled()) {
1079                _log.warn(msg.toString());
1080            }
1081
1082            throw new NoSuchBanException(msg.toString());
1083        }
1084
1085        return mbBan;
1086    }
1087
1088    public MBBan fetchByG_B(long groupId, long banUserId)
1089        throws SystemException {
1090        return fetchByG_B(groupId, banUserId, true);
1091    }
1092
1093    public MBBan fetchByG_B(long groupId, long banUserId,
1094        boolean retrieveFromCache) throws SystemException {
1095        Object[] finderArgs = new Object[] {
1096                new Long(groupId), new Long(banUserId)
1097            };
1098
1099        Object result = null;
1100
1101        if (retrieveFromCache) {
1102            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_B,
1103                    finderArgs, this);
1104        }
1105
1106        if (result == null) {
1107            Session session = null;
1108
1109            try {
1110                session = openSession();
1111
1112                StringBundler query = new StringBundler(3);
1113
1114                query.append(_SQL_SELECT_MBBAN_WHERE);
1115
1116                query.append(_FINDER_COLUMN_G_B_GROUPID_2);
1117
1118                query.append(_FINDER_COLUMN_G_B_BANUSERID_2);
1119
1120                String sql = query.toString();
1121
1122                Query q = session.createQuery(sql);
1123
1124                QueryPos qPos = QueryPos.getInstance(q);
1125
1126                qPos.add(groupId);
1127
1128                qPos.add(banUserId);
1129
1130                List<MBBan> list = q.list();
1131
1132                result = list;
1133
1134                MBBan mbBan = null;
1135
1136                if (list.isEmpty()) {
1137                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_B,
1138                        finderArgs, list);
1139                }
1140                else {
1141                    mbBan = list.get(0);
1142
1143                    cacheResult(mbBan);
1144
1145                    if ((mbBan.getGroupId() != groupId) ||
1146                            (mbBan.getBanUserId() != banUserId)) {
1147                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_B,
1148                            finderArgs, mbBan);
1149                    }
1150                }
1151
1152                return mbBan;
1153            }
1154            catch (Exception e) {
1155                throw processException(e);
1156            }
1157            finally {
1158                if (result == null) {
1159                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_B,
1160                        finderArgs, new ArrayList<MBBan>());
1161                }
1162
1163                closeSession(session);
1164            }
1165        }
1166        else {
1167            if (result instanceof List<?>) {
1168                return null;
1169            }
1170            else {
1171                return (MBBan)result;
1172            }
1173        }
1174    }
1175
1176    public List<MBBan> findAll() throws SystemException {
1177        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1178    }
1179
1180    public List<MBBan> findAll(int start, int end) throws SystemException {
1181        return findAll(start, end, null);
1182    }
1183
1184    public List<MBBan> findAll(int start, int end,
1185        OrderByComparator orderByComparator) throws SystemException {
1186        Object[] finderArgs = new Object[] {
1187                String.valueOf(start), String.valueOf(end),
1188                String.valueOf(orderByComparator)
1189            };
1190
1191        List<MBBan> list = (List<MBBan>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1192                finderArgs, this);
1193
1194        if (list == null) {
1195            Session session = null;
1196
1197            try {
1198                session = openSession();
1199
1200                StringBundler query = null;
1201                String sql = null;
1202
1203                if (orderByComparator != null) {
1204                    query = new StringBundler(2 +
1205                            (orderByComparator.getOrderByFields().length * 3));
1206
1207                    query.append(_SQL_SELECT_MBBAN);
1208
1209                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1210                        orderByComparator);
1211
1212                    sql = query.toString();
1213                }
1214
1215                sql = _SQL_SELECT_MBBAN;
1216
1217                Query q = session.createQuery(sql);
1218
1219                if (orderByComparator == null) {
1220                    list = (List<MBBan>)QueryUtil.list(q, getDialect(), start,
1221                            end, false);
1222
1223                    Collections.sort(list);
1224                }
1225                else {
1226                    list = (List<MBBan>)QueryUtil.list(q, getDialect(), start,
1227                            end);
1228                }
1229            }
1230            catch (Exception e) {
1231                throw processException(e);
1232            }
1233            finally {
1234                if (list == null) {
1235                    list = new ArrayList<MBBan>();
1236                }
1237
1238                cacheResult(list);
1239
1240                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1241
1242                closeSession(session);
1243            }
1244        }
1245
1246        return list;
1247    }
1248
1249    public void removeByGroupId(long groupId) throws SystemException {
1250        for (MBBan mbBan : findByGroupId(groupId)) {
1251            remove(mbBan);
1252        }
1253    }
1254
1255    public void removeByUserId(long userId) throws SystemException {
1256        for (MBBan mbBan : findByUserId(userId)) {
1257            remove(mbBan);
1258        }
1259    }
1260
1261    public void removeByBanUserId(long banUserId) throws SystemException {
1262        for (MBBan mbBan : findByBanUserId(banUserId)) {
1263            remove(mbBan);
1264        }
1265    }
1266
1267    public void removeByG_B(long groupId, long banUserId)
1268        throws NoSuchBanException, SystemException {
1269        MBBan mbBan = findByG_B(groupId, banUserId);
1270
1271        remove(mbBan);
1272    }
1273
1274    public void removeAll() throws SystemException {
1275        for (MBBan mbBan : findAll()) {
1276            remove(mbBan);
1277        }
1278    }
1279
1280    public int countByGroupId(long groupId) throws SystemException {
1281        Object[] finderArgs = new Object[] { new Long(groupId) };
1282
1283        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1284                finderArgs, this);
1285
1286        if (count == null) {
1287            Session session = null;
1288
1289            try {
1290                session = openSession();
1291
1292                StringBundler query = new StringBundler(2);
1293
1294                query.append(_SQL_COUNT_MBBAN_WHERE);
1295
1296                query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1297
1298                String sql = query.toString();
1299
1300                Query q = session.createQuery(sql);
1301
1302                QueryPos qPos = QueryPos.getInstance(q);
1303
1304                qPos.add(groupId);
1305
1306                count = (Long)q.uniqueResult();
1307            }
1308            catch (Exception e) {
1309                throw processException(e);
1310            }
1311            finally {
1312                if (count == null) {
1313                    count = Long.valueOf(0);
1314                }
1315
1316                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1317                    finderArgs, count);
1318
1319                closeSession(session);
1320            }
1321        }
1322
1323        return count.intValue();
1324    }
1325
1326    public int countByUserId(long userId) throws SystemException {
1327        Object[] finderArgs = new Object[] { new Long(userId) };
1328
1329        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
1330                finderArgs, this);
1331
1332        if (count == null) {
1333            Session session = null;
1334
1335            try {
1336                session = openSession();
1337
1338                StringBundler query = new StringBundler(2);
1339
1340                query.append(_SQL_COUNT_MBBAN_WHERE);
1341
1342                query.append(_FINDER_COLUMN_USERID_USERID_2);
1343
1344                String sql = query.toString();
1345
1346                Query q = session.createQuery(sql);
1347
1348                QueryPos qPos = QueryPos.getInstance(q);
1349
1350                qPos.add(userId);
1351
1352                count = (Long)q.uniqueResult();
1353            }
1354            catch (Exception e) {
1355                throw processException(e);
1356            }
1357            finally {
1358                if (count == null) {
1359                    count = Long.valueOf(0);
1360                }
1361
1362                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
1363                    finderArgs, count);
1364
1365                closeSession(session);
1366            }
1367        }
1368
1369        return count.intValue();
1370    }
1371
1372    public int countByBanUserId(long banUserId) throws SystemException {
1373        Object[] finderArgs = new Object[] { new Long(banUserId) };
1374
1375        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_BANUSERID,
1376                finderArgs, this);
1377
1378        if (count == null) {
1379            Session session = null;
1380
1381            try {
1382                session = openSession();
1383
1384                StringBundler query = new StringBundler(2);
1385
1386                query.append(_SQL_COUNT_MBBAN_WHERE);
1387
1388                query.append(_FINDER_COLUMN_BANUSERID_BANUSERID_2);
1389
1390                String sql = query.toString();
1391
1392                Query q = session.createQuery(sql);
1393
1394                QueryPos qPos = QueryPos.getInstance(q);
1395
1396                qPos.add(banUserId);
1397
1398                count = (Long)q.uniqueResult();
1399            }
1400            catch (Exception e) {
1401                throw processException(e);
1402            }
1403            finally {
1404                if (count == null) {
1405                    count = Long.valueOf(0);
1406                }
1407
1408                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_BANUSERID,
1409                    finderArgs, count);
1410
1411                closeSession(session);
1412            }
1413        }
1414
1415        return count.intValue();
1416    }
1417
1418    public int countByG_B(long groupId, long banUserId)
1419        throws SystemException {
1420        Object[] finderArgs = new Object[] {
1421                new Long(groupId), new Long(banUserId)
1422            };
1423
1424        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_B,
1425                finderArgs, this);
1426
1427        if (count == null) {
1428            Session session = null;
1429
1430            try {
1431                session = openSession();
1432
1433                StringBundler query = new StringBundler(3);
1434
1435                query.append(_SQL_COUNT_MBBAN_WHERE);
1436
1437                query.append(_FINDER_COLUMN_G_B_GROUPID_2);
1438
1439                query.append(_FINDER_COLUMN_G_B_BANUSERID_2);
1440
1441                String sql = query.toString();
1442
1443                Query q = session.createQuery(sql);
1444
1445                QueryPos qPos = QueryPos.getInstance(q);
1446
1447                qPos.add(groupId);
1448
1449                qPos.add(banUserId);
1450
1451                count = (Long)q.uniqueResult();
1452            }
1453            catch (Exception e) {
1454                throw processException(e);
1455            }
1456            finally {
1457                if (count == null) {
1458                    count = Long.valueOf(0);
1459                }
1460
1461                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_B, finderArgs,
1462                    count);
1463
1464                closeSession(session);
1465            }
1466        }
1467
1468        return count.intValue();
1469    }
1470
1471    public int countAll() throws SystemException {
1472        Object[] finderArgs = new Object[0];
1473
1474        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1475                finderArgs, this);
1476
1477        if (count == null) {
1478            Session session = null;
1479
1480            try {
1481                session = openSession();
1482
1483                Query q = session.createQuery(_SQL_COUNT_MBBAN);
1484
1485                count = (Long)q.uniqueResult();
1486            }
1487            catch (Exception e) {
1488                throw processException(e);
1489            }
1490            finally {
1491                if (count == null) {
1492                    count = Long.valueOf(0);
1493                }
1494
1495                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1496                    count);
1497
1498                closeSession(session);
1499            }
1500        }
1501
1502        return count.intValue();
1503    }
1504
1505    public void afterPropertiesSet() {
1506        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1507                    com.liferay.portal.util.PropsUtil.get(
1508                        "value.object.listener.com.liferay.portlet.messageboards.model.MBBan")));
1509
1510        if (listenerClassNames.length > 0) {
1511            try {
1512                List<ModelListener<MBBan>> listenersList = new ArrayList<ModelListener<MBBan>>();
1513
1514                for (String listenerClassName : listenerClassNames) {
1515                    listenersList.add((ModelListener<MBBan>)Class.forName(
1516                            listenerClassName).newInstance());
1517                }
1518
1519                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1520            }
1521            catch (Exception e) {
1522                _log.error(e);
1523            }
1524        }
1525    }
1526
1527    @BeanReference(type = MBBanPersistence.class)
1528    protected MBBanPersistence mbBanPersistence;
1529    @BeanReference(type = MBCategoryPersistence.class)
1530    protected MBCategoryPersistence mbCategoryPersistence;
1531    @BeanReference(type = MBDiscussionPersistence.class)
1532    protected MBDiscussionPersistence mbDiscussionPersistence;
1533    @BeanReference(type = MBMailingListPersistence.class)
1534    protected MBMailingListPersistence mbMailingListPersistence;
1535    @BeanReference(type = MBMessagePersistence.class)
1536    protected MBMessagePersistence mbMessagePersistence;
1537    @BeanReference(type = MBMessageFlagPersistence.class)
1538    protected MBMessageFlagPersistence mbMessageFlagPersistence;
1539    @BeanReference(type = MBStatsUserPersistence.class)
1540    protected MBStatsUserPersistence mbStatsUserPersistence;
1541    @BeanReference(type = MBThreadPersistence.class)
1542    protected MBThreadPersistence mbThreadPersistence;
1543    @BeanReference(type = ResourcePersistence.class)
1544    protected ResourcePersistence resourcePersistence;
1545    @BeanReference(type = UserPersistence.class)
1546    protected UserPersistence userPersistence;
1547    private static final String _SQL_SELECT_MBBAN = "SELECT mbBan FROM MBBan mbBan";
1548    private static final String _SQL_SELECT_MBBAN_WHERE = "SELECT mbBan FROM MBBan mbBan WHERE ";
1549    private static final String _SQL_COUNT_MBBAN = "SELECT COUNT(mbBan) FROM MBBan mbBan";
1550    private static final String _SQL_COUNT_MBBAN_WHERE = "SELECT COUNT(mbBan) FROM MBBan mbBan WHERE ";
1551    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "mbBan.groupId = ?";
1552    private static final String _FINDER_COLUMN_USERID_USERID_2 = "mbBan.userId = ?";
1553    private static final String _FINDER_COLUMN_BANUSERID_BANUSERID_2 = "mbBan.banUserId = ?";
1554    private static final String _FINDER_COLUMN_G_B_GROUPID_2 = "mbBan.groupId = ? AND ";
1555    private static final String _FINDER_COLUMN_G_B_BANUSERID_2 = "mbBan.banUserId = ?";
1556    private static final String _ORDER_BY_ENTITY_ALIAS = "mbBan.";
1557    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No MBBan exists with the primary key ";
1558    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No MBBan exists with the key {";
1559    private static Log _log = LogFactoryUtil.getLog(MBBanPersistenceImpl.class);
1560}