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