001
014
015 package com.liferay.portlet.messageboards.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.Session;
027 import com.liferay.portal.kernel.exception.SystemException;
028 import com.liferay.portal.kernel.log.Log;
029 import com.liferay.portal.kernel.log.LogFactoryUtil;
030 import com.liferay.portal.kernel.util.GetterUtil;
031 import com.liferay.portal.kernel.util.InstanceFactory;
032 import com.liferay.portal.kernel.util.OrderByComparator;
033 import com.liferay.portal.kernel.util.StringBundler;
034 import com.liferay.portal.kernel.util.StringPool;
035 import com.liferay.portal.kernel.util.StringUtil;
036 import com.liferay.portal.model.CacheModel;
037 import com.liferay.portal.model.ModelListener;
038 import com.liferay.portal.service.persistence.BatchSessionUtil;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserPersistence;
041 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
042
043 import com.liferay.portlet.messageboards.NoSuchDiscussionException;
044 import com.liferay.portlet.messageboards.model.MBDiscussion;
045 import com.liferay.portlet.messageboards.model.impl.MBDiscussionImpl;
046 import com.liferay.portlet.messageboards.model.impl.MBDiscussionModelImpl;
047
048 import java.io.Serializable;
049
050 import java.util.ArrayList;
051 import java.util.Collections;
052 import java.util.List;
053
054
066 public class MBDiscussionPersistenceImpl extends BasePersistenceImpl<MBDiscussion>
067 implements MBDiscussionPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = MBDiscussionImpl.class.getName();
074 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
075 ".List1";
076 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
077 ".List2";
078 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID =
079 new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
080 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByClassNameId",
082 new String[] {
083 Long.class.getName(),
084
085 "java.lang.Integer", "java.lang.Integer",
086 "com.liferay.portal.kernel.util.OrderByComparator"
087 });
088 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID =
089 new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
090 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
091 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByClassNameId",
092 new String[] { Long.class.getName() },
093 MBDiscussionModelImpl.CLASSNAMEID_COLUMN_BITMASK);
094 public static final FinderPath FINDER_PATH_COUNT_BY_CLASSNAMEID = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
095 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, Long.class,
096 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByClassNameId",
097 new String[] { Long.class.getName() });
098 public static final FinderPath FINDER_PATH_FETCH_BY_THREADID = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
099 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
100 FINDER_CLASS_NAME_ENTITY, "fetchByThreadId",
101 new String[] { Long.class.getName() },
102 MBDiscussionModelImpl.THREADID_COLUMN_BITMASK);
103 public static final FinderPath FINDER_PATH_COUNT_BY_THREADID = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
104 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, Long.class,
105 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByThreadId",
106 new String[] { Long.class.getName() });
107 public static final FinderPath FINDER_PATH_FETCH_BY_C_C = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
108 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
109 FINDER_CLASS_NAME_ENTITY, "fetchByC_C",
110 new String[] { Long.class.getName(), Long.class.getName() },
111 MBDiscussionModelImpl.CLASSNAMEID_COLUMN_BITMASK |
112 MBDiscussionModelImpl.CLASSPK_COLUMN_BITMASK);
113 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
114 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, Long.class,
115 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
116 new String[] { Long.class.getName(), Long.class.getName() });
117 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
118 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
119 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
120 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
121 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, MBDiscussionImpl.class,
122 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
123 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
124 MBDiscussionModelImpl.FINDER_CACHE_ENABLED, Long.class,
125 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
126
127
132 public void cacheResult(MBDiscussion mbDiscussion) {
133 EntityCacheUtil.putResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
134 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey(), mbDiscussion);
135
136 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
137 new Object[] { Long.valueOf(mbDiscussion.getThreadId()) },
138 mbDiscussion);
139
140 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
141 new Object[] {
142 Long.valueOf(mbDiscussion.getClassNameId()),
143 Long.valueOf(mbDiscussion.getClassPK())
144 }, mbDiscussion);
145
146 mbDiscussion.resetOriginalValues();
147 }
148
149
154 public void cacheResult(List<MBDiscussion> mbDiscussions) {
155 for (MBDiscussion mbDiscussion : mbDiscussions) {
156 if (EntityCacheUtil.getResult(
157 MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
158 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey()) == null) {
159 cacheResult(mbDiscussion);
160 }
161 else {
162 mbDiscussion.resetOriginalValues();
163 }
164 }
165 }
166
167
174 @Override
175 public void clearCache() {
176 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
177 CacheRegistryUtil.clear(MBDiscussionImpl.class.getName());
178 }
179
180 EntityCacheUtil.clearCache(MBDiscussionImpl.class.getName());
181
182 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
183 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
184 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
185 }
186
187
194 @Override
195 public void clearCache(MBDiscussion mbDiscussion) {
196 EntityCacheUtil.removeResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
197 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey());
198
199 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
200 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
201
202 clearUniqueFindersCache(mbDiscussion);
203 }
204
205 @Override
206 public void clearCache(List<MBDiscussion> mbDiscussions) {
207 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
208 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
209
210 for (MBDiscussion mbDiscussion : mbDiscussions) {
211 EntityCacheUtil.removeResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
212 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey());
213
214 clearUniqueFindersCache(mbDiscussion);
215 }
216 }
217
218 protected void clearUniqueFindersCache(MBDiscussion mbDiscussion) {
219 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID,
220 new Object[] { Long.valueOf(mbDiscussion.getThreadId()) });
221
222 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
223 new Object[] {
224 Long.valueOf(mbDiscussion.getClassNameId()),
225 Long.valueOf(mbDiscussion.getClassPK())
226 });
227 }
228
229
235 public MBDiscussion create(long discussionId) {
236 MBDiscussion mbDiscussion = new MBDiscussionImpl();
237
238 mbDiscussion.setNew(true);
239 mbDiscussion.setPrimaryKey(discussionId);
240
241 return mbDiscussion;
242 }
243
244
252 public MBDiscussion remove(long discussionId)
253 throws NoSuchDiscussionException, SystemException {
254 return remove(Long.valueOf(discussionId));
255 }
256
257
265 @Override
266 public MBDiscussion remove(Serializable primaryKey)
267 throws NoSuchDiscussionException, SystemException {
268 Session session = null;
269
270 try {
271 session = openSession();
272
273 MBDiscussion mbDiscussion = (MBDiscussion)session.get(MBDiscussionImpl.class,
274 primaryKey);
275
276 if (mbDiscussion == null) {
277 if (_log.isWarnEnabled()) {
278 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
279 }
280
281 throw new NoSuchDiscussionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
282 primaryKey);
283 }
284
285 return remove(mbDiscussion);
286 }
287 catch (NoSuchDiscussionException nsee) {
288 throw nsee;
289 }
290 catch (Exception e) {
291 throw processException(e);
292 }
293 finally {
294 closeSession(session);
295 }
296 }
297
298 @Override
299 protected MBDiscussion removeImpl(MBDiscussion mbDiscussion)
300 throws SystemException {
301 mbDiscussion = toUnwrappedModel(mbDiscussion);
302
303 Session session = null;
304
305 try {
306 session = openSession();
307
308 BatchSessionUtil.delete(session, mbDiscussion);
309 }
310 catch (Exception e) {
311 throw processException(e);
312 }
313 finally {
314 closeSession(session);
315 }
316
317 clearCache(mbDiscussion);
318
319 return mbDiscussion;
320 }
321
322 @Override
323 public MBDiscussion updateImpl(
324 com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion,
325 boolean merge) throws SystemException {
326 mbDiscussion = toUnwrappedModel(mbDiscussion);
327
328 boolean isNew = mbDiscussion.isNew();
329
330 MBDiscussionModelImpl mbDiscussionModelImpl = (MBDiscussionModelImpl)mbDiscussion;
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 BatchSessionUtil.update(session, mbDiscussion, merge);
338
339 mbDiscussion.setNew(false);
340 }
341 catch (Exception e) {
342 throw processException(e);
343 }
344 finally {
345 closeSession(session);
346 }
347
348 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
349
350 if (isNew || !MBDiscussionModelImpl.COLUMN_BITMASK_ENABLED) {
351 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
352 }
353
354 else {
355 if ((mbDiscussionModelImpl.getColumnBitmask() &
356 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID.getColumnBitmask()) != 0) {
357 Object[] args = new Object[] {
358 Long.valueOf(mbDiscussionModelImpl.getOriginalClassNameId())
359 };
360
361 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
362 args);
363 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
364 args);
365
366 args = new Object[] {
367 Long.valueOf(mbDiscussionModelImpl.getClassNameId())
368 };
369
370 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
371 args);
372 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
373 args);
374 }
375 }
376
377 EntityCacheUtil.putResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
378 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey(), mbDiscussion);
379
380 if (isNew) {
381 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
382 new Object[] { Long.valueOf(mbDiscussion.getThreadId()) },
383 mbDiscussion);
384
385 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
386 new Object[] {
387 Long.valueOf(mbDiscussion.getClassNameId()),
388 Long.valueOf(mbDiscussion.getClassPK())
389 }, mbDiscussion);
390 }
391 else {
392 if ((mbDiscussionModelImpl.getColumnBitmask() &
393 FINDER_PATH_FETCH_BY_THREADID.getColumnBitmask()) != 0) {
394 Object[] args = new Object[] {
395 Long.valueOf(mbDiscussionModelImpl.getOriginalThreadId())
396 };
397
398 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_THREADID, args);
399
400 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID, args);
401
402 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
403 new Object[] { Long.valueOf(mbDiscussion.getThreadId()) },
404 mbDiscussion);
405 }
406
407 if ((mbDiscussionModelImpl.getColumnBitmask() &
408 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
409 Object[] args = new Object[] {
410 Long.valueOf(mbDiscussionModelImpl.getOriginalClassNameId()),
411 Long.valueOf(mbDiscussionModelImpl.getOriginalClassPK())
412 };
413
414 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
415
416 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
417
418 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
419 new Object[] {
420 Long.valueOf(mbDiscussion.getClassNameId()),
421 Long.valueOf(mbDiscussion.getClassPK())
422 }, mbDiscussion);
423 }
424 }
425
426 return mbDiscussion;
427 }
428
429 protected MBDiscussion toUnwrappedModel(MBDiscussion mbDiscussion) {
430 if (mbDiscussion instanceof MBDiscussionImpl) {
431 return mbDiscussion;
432 }
433
434 MBDiscussionImpl mbDiscussionImpl = new MBDiscussionImpl();
435
436 mbDiscussionImpl.setNew(mbDiscussion.isNew());
437 mbDiscussionImpl.setPrimaryKey(mbDiscussion.getPrimaryKey());
438
439 mbDiscussionImpl.setDiscussionId(mbDiscussion.getDiscussionId());
440 mbDiscussionImpl.setClassNameId(mbDiscussion.getClassNameId());
441 mbDiscussionImpl.setClassPK(mbDiscussion.getClassPK());
442 mbDiscussionImpl.setThreadId(mbDiscussion.getThreadId());
443
444 return mbDiscussionImpl;
445 }
446
447
455 @Override
456 public MBDiscussion findByPrimaryKey(Serializable primaryKey)
457 throws NoSuchModelException, SystemException {
458 return findByPrimaryKey(((Long)primaryKey).longValue());
459 }
460
461
469 public MBDiscussion findByPrimaryKey(long discussionId)
470 throws NoSuchDiscussionException, SystemException {
471 MBDiscussion mbDiscussion = fetchByPrimaryKey(discussionId);
472
473 if (mbDiscussion == null) {
474 if (_log.isWarnEnabled()) {
475 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + discussionId);
476 }
477
478 throw new NoSuchDiscussionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
479 discussionId);
480 }
481
482 return mbDiscussion;
483 }
484
485
492 @Override
493 public MBDiscussion fetchByPrimaryKey(Serializable primaryKey)
494 throws SystemException {
495 return fetchByPrimaryKey(((Long)primaryKey).longValue());
496 }
497
498
505 public MBDiscussion fetchByPrimaryKey(long discussionId)
506 throws SystemException {
507 MBDiscussion mbDiscussion = (MBDiscussion)EntityCacheUtil.getResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
508 MBDiscussionImpl.class, discussionId);
509
510 if (mbDiscussion == _nullMBDiscussion) {
511 return null;
512 }
513
514 if (mbDiscussion == null) {
515 Session session = null;
516
517 boolean hasException = false;
518
519 try {
520 session = openSession();
521
522 mbDiscussion = (MBDiscussion)session.get(MBDiscussionImpl.class,
523 Long.valueOf(discussionId));
524 }
525 catch (Exception e) {
526 hasException = true;
527
528 throw processException(e);
529 }
530 finally {
531 if (mbDiscussion != null) {
532 cacheResult(mbDiscussion);
533 }
534 else if (!hasException) {
535 EntityCacheUtil.putResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
536 MBDiscussionImpl.class, discussionId, _nullMBDiscussion);
537 }
538
539 closeSession(session);
540 }
541 }
542
543 return mbDiscussion;
544 }
545
546
553 public List<MBDiscussion> findByClassNameId(long classNameId)
554 throws SystemException {
555 return findByClassNameId(classNameId, QueryUtil.ALL_POS,
556 QueryUtil.ALL_POS, null);
557 }
558
559
572 public List<MBDiscussion> findByClassNameId(long classNameId, int start,
573 int end) throws SystemException {
574 return findByClassNameId(classNameId, start, end, null);
575 }
576
577
591 public List<MBDiscussion> findByClassNameId(long classNameId, int start,
592 int end, OrderByComparator orderByComparator) throws SystemException {
593 FinderPath finderPath = null;
594 Object[] finderArgs = null;
595
596 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
597 (orderByComparator == null)) {
598 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
599 finderArgs = new Object[] { classNameId };
600 }
601 else {
602 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
603 finderArgs = new Object[] { classNameId, start, end, orderByComparator };
604 }
605
606 List<MBDiscussion> list = (List<MBDiscussion>)FinderCacheUtil.getResult(finderPath,
607 finderArgs, this);
608
609 if ((list != null) && !list.isEmpty()) {
610 for (MBDiscussion mbDiscussion : list) {
611 if ((classNameId != mbDiscussion.getClassNameId())) {
612 list = null;
613
614 break;
615 }
616 }
617 }
618
619 if (list == null) {
620 StringBundler query = null;
621
622 if (orderByComparator != null) {
623 query = new StringBundler(3 +
624 (orderByComparator.getOrderByFields().length * 3));
625 }
626 else {
627 query = new StringBundler(2);
628 }
629
630 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
631
632 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
633
634 if (orderByComparator != null) {
635 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
636 orderByComparator);
637 }
638
639 String sql = query.toString();
640
641 Session session = null;
642
643 try {
644 session = openSession();
645
646 Query q = session.createQuery(sql);
647
648 QueryPos qPos = QueryPos.getInstance(q);
649
650 qPos.add(classNameId);
651
652 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
653 start, end);
654 }
655 catch (Exception e) {
656 throw processException(e);
657 }
658 finally {
659 if (list == null) {
660 FinderCacheUtil.removeResult(finderPath, finderArgs);
661 }
662 else {
663 cacheResult(list);
664
665 FinderCacheUtil.putResult(finderPath, finderArgs, list);
666 }
667
668 closeSession(session);
669 }
670 }
671
672 return list;
673 }
674
675
684 public MBDiscussion findByClassNameId_First(long classNameId,
685 OrderByComparator orderByComparator)
686 throws NoSuchDiscussionException, SystemException {
687 MBDiscussion mbDiscussion = fetchByClassNameId_First(classNameId,
688 orderByComparator);
689
690 if (mbDiscussion != null) {
691 return mbDiscussion;
692 }
693
694 StringBundler msg = new StringBundler(4);
695
696 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
697
698 msg.append("classNameId=");
699 msg.append(classNameId);
700
701 msg.append(StringPool.CLOSE_CURLY_BRACE);
702
703 throw new NoSuchDiscussionException(msg.toString());
704 }
705
706
714 public MBDiscussion fetchByClassNameId_First(long classNameId,
715 OrderByComparator orderByComparator) throws SystemException {
716 List<MBDiscussion> list = findByClassNameId(classNameId, 0, 1,
717 orderByComparator);
718
719 if (!list.isEmpty()) {
720 return list.get(0);
721 }
722
723 return null;
724 }
725
726
735 public MBDiscussion findByClassNameId_Last(long classNameId,
736 OrderByComparator orderByComparator)
737 throws NoSuchDiscussionException, SystemException {
738 MBDiscussion mbDiscussion = fetchByClassNameId_Last(classNameId,
739 orderByComparator);
740
741 if (mbDiscussion != null) {
742 return mbDiscussion;
743 }
744
745 StringBundler msg = new StringBundler(4);
746
747 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
748
749 msg.append("classNameId=");
750 msg.append(classNameId);
751
752 msg.append(StringPool.CLOSE_CURLY_BRACE);
753
754 throw new NoSuchDiscussionException(msg.toString());
755 }
756
757
765 public MBDiscussion fetchByClassNameId_Last(long classNameId,
766 OrderByComparator orderByComparator) throws SystemException {
767 int count = countByClassNameId(classNameId);
768
769 List<MBDiscussion> list = findByClassNameId(classNameId, count - 1,
770 count, orderByComparator);
771
772 if (!list.isEmpty()) {
773 return list.get(0);
774 }
775
776 return null;
777 }
778
779
789 public MBDiscussion[] findByClassNameId_PrevAndNext(long discussionId,
790 long classNameId, OrderByComparator orderByComparator)
791 throws NoSuchDiscussionException, SystemException {
792 MBDiscussion mbDiscussion = findByPrimaryKey(discussionId);
793
794 Session session = null;
795
796 try {
797 session = openSession();
798
799 MBDiscussion[] array = new MBDiscussionImpl[3];
800
801 array[0] = getByClassNameId_PrevAndNext(session, mbDiscussion,
802 classNameId, orderByComparator, true);
803
804 array[1] = mbDiscussion;
805
806 array[2] = getByClassNameId_PrevAndNext(session, mbDiscussion,
807 classNameId, orderByComparator, false);
808
809 return array;
810 }
811 catch (Exception e) {
812 throw processException(e);
813 }
814 finally {
815 closeSession(session);
816 }
817 }
818
819 protected MBDiscussion getByClassNameId_PrevAndNext(Session session,
820 MBDiscussion mbDiscussion, long classNameId,
821 OrderByComparator orderByComparator, boolean previous) {
822 StringBundler query = null;
823
824 if (orderByComparator != null) {
825 query = new StringBundler(6 +
826 (orderByComparator.getOrderByFields().length * 6));
827 }
828 else {
829 query = new StringBundler(3);
830 }
831
832 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
833
834 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
835
836 if (orderByComparator != null) {
837 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
838
839 if (orderByConditionFields.length > 0) {
840 query.append(WHERE_AND);
841 }
842
843 for (int i = 0; i < orderByConditionFields.length; i++) {
844 query.append(_ORDER_BY_ENTITY_ALIAS);
845 query.append(orderByConditionFields[i]);
846
847 if ((i + 1) < orderByConditionFields.length) {
848 if (orderByComparator.isAscending() ^ previous) {
849 query.append(WHERE_GREATER_THAN_HAS_NEXT);
850 }
851 else {
852 query.append(WHERE_LESSER_THAN_HAS_NEXT);
853 }
854 }
855 else {
856 if (orderByComparator.isAscending() ^ previous) {
857 query.append(WHERE_GREATER_THAN);
858 }
859 else {
860 query.append(WHERE_LESSER_THAN);
861 }
862 }
863 }
864
865 query.append(ORDER_BY_CLAUSE);
866
867 String[] orderByFields = orderByComparator.getOrderByFields();
868
869 for (int i = 0; i < orderByFields.length; i++) {
870 query.append(_ORDER_BY_ENTITY_ALIAS);
871 query.append(orderByFields[i]);
872
873 if ((i + 1) < orderByFields.length) {
874 if (orderByComparator.isAscending() ^ previous) {
875 query.append(ORDER_BY_ASC_HAS_NEXT);
876 }
877 else {
878 query.append(ORDER_BY_DESC_HAS_NEXT);
879 }
880 }
881 else {
882 if (orderByComparator.isAscending() ^ previous) {
883 query.append(ORDER_BY_ASC);
884 }
885 else {
886 query.append(ORDER_BY_DESC);
887 }
888 }
889 }
890 }
891
892 String sql = query.toString();
893
894 Query q = session.createQuery(sql);
895
896 q.setFirstResult(0);
897 q.setMaxResults(2);
898
899 QueryPos qPos = QueryPos.getInstance(q);
900
901 qPos.add(classNameId);
902
903 if (orderByComparator != null) {
904 Object[] values = orderByComparator.getOrderByConditionValues(mbDiscussion);
905
906 for (Object value : values) {
907 qPos.add(value);
908 }
909 }
910
911 List<MBDiscussion> list = q.list();
912
913 if (list.size() == 2) {
914 return list.get(1);
915 }
916 else {
917 return null;
918 }
919 }
920
921
929 public MBDiscussion findByThreadId(long threadId)
930 throws NoSuchDiscussionException, SystemException {
931 MBDiscussion mbDiscussion = fetchByThreadId(threadId);
932
933 if (mbDiscussion == null) {
934 StringBundler msg = new StringBundler(4);
935
936 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
937
938 msg.append("threadId=");
939 msg.append(threadId);
940
941 msg.append(StringPool.CLOSE_CURLY_BRACE);
942
943 if (_log.isWarnEnabled()) {
944 _log.warn(msg.toString());
945 }
946
947 throw new NoSuchDiscussionException(msg.toString());
948 }
949
950 return mbDiscussion;
951 }
952
953
960 public MBDiscussion fetchByThreadId(long threadId)
961 throws SystemException {
962 return fetchByThreadId(threadId, true);
963 }
964
965
973 public MBDiscussion fetchByThreadId(long threadId, boolean retrieveFromCache)
974 throws SystemException {
975 Object[] finderArgs = new Object[] { threadId };
976
977 Object result = null;
978
979 if (retrieveFromCache) {
980 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_THREADID,
981 finderArgs, this);
982 }
983
984 if (result instanceof MBDiscussion) {
985 MBDiscussion mbDiscussion = (MBDiscussion)result;
986
987 if ((threadId != mbDiscussion.getThreadId())) {
988 result = null;
989 }
990 }
991
992 if (result == null) {
993 StringBundler query = new StringBundler(2);
994
995 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
996
997 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
998
999 String sql = query.toString();
1000
1001 Session session = null;
1002
1003 try {
1004 session = openSession();
1005
1006 Query q = session.createQuery(sql);
1007
1008 QueryPos qPos = QueryPos.getInstance(q);
1009
1010 qPos.add(threadId);
1011
1012 List<MBDiscussion> list = q.list();
1013
1014 result = list;
1015
1016 MBDiscussion mbDiscussion = null;
1017
1018 if (list.isEmpty()) {
1019 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
1020 finderArgs, list);
1021 }
1022 else {
1023 mbDiscussion = list.get(0);
1024
1025 cacheResult(mbDiscussion);
1026
1027 if ((mbDiscussion.getThreadId() != threadId)) {
1028 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
1029 finderArgs, mbDiscussion);
1030 }
1031 }
1032
1033 return mbDiscussion;
1034 }
1035 catch (Exception e) {
1036 throw processException(e);
1037 }
1038 finally {
1039 if (result == null) {
1040 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID,
1041 finderArgs);
1042 }
1043
1044 closeSession(session);
1045 }
1046 }
1047 else {
1048 if (result instanceof List<?>) {
1049 return null;
1050 }
1051 else {
1052 return (MBDiscussion)result;
1053 }
1054 }
1055 }
1056
1057
1066 public MBDiscussion findByC_C(long classNameId, long classPK)
1067 throws NoSuchDiscussionException, SystemException {
1068 MBDiscussion mbDiscussion = fetchByC_C(classNameId, classPK);
1069
1070 if (mbDiscussion == null) {
1071 StringBundler msg = new StringBundler(6);
1072
1073 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1074
1075 msg.append("classNameId=");
1076 msg.append(classNameId);
1077
1078 msg.append(", classPK=");
1079 msg.append(classPK);
1080
1081 msg.append(StringPool.CLOSE_CURLY_BRACE);
1082
1083 if (_log.isWarnEnabled()) {
1084 _log.warn(msg.toString());
1085 }
1086
1087 throw new NoSuchDiscussionException(msg.toString());
1088 }
1089
1090 return mbDiscussion;
1091 }
1092
1093
1101 public MBDiscussion fetchByC_C(long classNameId, long classPK)
1102 throws SystemException {
1103 return fetchByC_C(classNameId, classPK, true);
1104 }
1105
1106
1115 public MBDiscussion fetchByC_C(long classNameId, long classPK,
1116 boolean retrieveFromCache) throws SystemException {
1117 Object[] finderArgs = new Object[] { classNameId, classPK };
1118
1119 Object result = null;
1120
1121 if (retrieveFromCache) {
1122 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
1123 finderArgs, this);
1124 }
1125
1126 if (result instanceof MBDiscussion) {
1127 MBDiscussion mbDiscussion = (MBDiscussion)result;
1128
1129 if ((classNameId != mbDiscussion.getClassNameId()) ||
1130 (classPK != mbDiscussion.getClassPK())) {
1131 result = null;
1132 }
1133 }
1134
1135 if (result == null) {
1136 StringBundler query = new StringBundler(3);
1137
1138 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
1139
1140 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1141
1142 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1143
1144 String sql = query.toString();
1145
1146 Session session = null;
1147
1148 try {
1149 session = openSession();
1150
1151 Query q = session.createQuery(sql);
1152
1153 QueryPos qPos = QueryPos.getInstance(q);
1154
1155 qPos.add(classNameId);
1156
1157 qPos.add(classPK);
1158
1159 List<MBDiscussion> list = q.list();
1160
1161 result = list;
1162
1163 MBDiscussion mbDiscussion = null;
1164
1165 if (list.isEmpty()) {
1166 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1167 finderArgs, list);
1168 }
1169 else {
1170 mbDiscussion = list.get(0);
1171
1172 cacheResult(mbDiscussion);
1173
1174 if ((mbDiscussion.getClassNameId() != classNameId) ||
1175 (mbDiscussion.getClassPK() != classPK)) {
1176 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1177 finderArgs, mbDiscussion);
1178 }
1179 }
1180
1181 return mbDiscussion;
1182 }
1183 catch (Exception e) {
1184 throw processException(e);
1185 }
1186 finally {
1187 if (result == null) {
1188 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
1189 finderArgs);
1190 }
1191
1192 closeSession(session);
1193 }
1194 }
1195 else {
1196 if (result instanceof List<?>) {
1197 return null;
1198 }
1199 else {
1200 return (MBDiscussion)result;
1201 }
1202 }
1203 }
1204
1205
1211 public List<MBDiscussion> findAll() throws SystemException {
1212 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1213 }
1214
1215
1227 public List<MBDiscussion> findAll(int start, int end)
1228 throws SystemException {
1229 return findAll(start, end, null);
1230 }
1231
1232
1245 public List<MBDiscussion> findAll(int start, int end,
1246 OrderByComparator orderByComparator) throws SystemException {
1247 FinderPath finderPath = null;
1248 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1249
1250 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1251 (orderByComparator == null)) {
1252 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1253 finderArgs = FINDER_ARGS_EMPTY;
1254 }
1255 else {
1256 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1257 finderArgs = new Object[] { start, end, orderByComparator };
1258 }
1259
1260 List<MBDiscussion> list = (List<MBDiscussion>)FinderCacheUtil.getResult(finderPath,
1261 finderArgs, this);
1262
1263 if (list == null) {
1264 StringBundler query = null;
1265 String sql = null;
1266
1267 if (orderByComparator != null) {
1268 query = new StringBundler(2 +
1269 (orderByComparator.getOrderByFields().length * 3));
1270
1271 query.append(_SQL_SELECT_MBDISCUSSION);
1272
1273 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1274 orderByComparator);
1275
1276 sql = query.toString();
1277 }
1278 else {
1279 sql = _SQL_SELECT_MBDISCUSSION;
1280 }
1281
1282 Session session = null;
1283
1284 try {
1285 session = openSession();
1286
1287 Query q = session.createQuery(sql);
1288
1289 if (orderByComparator == null) {
1290 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
1291 start, end, false);
1292
1293 Collections.sort(list);
1294 }
1295 else {
1296 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
1297 start, end);
1298 }
1299 }
1300 catch (Exception e) {
1301 throw processException(e);
1302 }
1303 finally {
1304 if (list == null) {
1305 FinderCacheUtil.removeResult(finderPath, finderArgs);
1306 }
1307 else {
1308 cacheResult(list);
1309
1310 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1311 }
1312
1313 closeSession(session);
1314 }
1315 }
1316
1317 return list;
1318 }
1319
1320
1326 public void removeByClassNameId(long classNameId) throws SystemException {
1327 for (MBDiscussion mbDiscussion : findByClassNameId(classNameId)) {
1328 remove(mbDiscussion);
1329 }
1330 }
1331
1332
1339 public MBDiscussion removeByThreadId(long threadId)
1340 throws NoSuchDiscussionException, SystemException {
1341 MBDiscussion mbDiscussion = findByThreadId(threadId);
1342
1343 return remove(mbDiscussion);
1344 }
1345
1346
1354 public MBDiscussion removeByC_C(long classNameId, long classPK)
1355 throws NoSuchDiscussionException, SystemException {
1356 MBDiscussion mbDiscussion = findByC_C(classNameId, classPK);
1357
1358 return remove(mbDiscussion);
1359 }
1360
1361
1366 public void removeAll() throws SystemException {
1367 for (MBDiscussion mbDiscussion : findAll()) {
1368 remove(mbDiscussion);
1369 }
1370 }
1371
1372
1379 public int countByClassNameId(long classNameId) throws SystemException {
1380 Object[] finderArgs = new Object[] { classNameId };
1381
1382 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1383 finderArgs, this);
1384
1385 if (count == null) {
1386 StringBundler query = new StringBundler(2);
1387
1388 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1389
1390 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1391
1392 String sql = query.toString();
1393
1394 Session session = null;
1395
1396 try {
1397 session = openSession();
1398
1399 Query q = session.createQuery(sql);
1400
1401 QueryPos qPos = QueryPos.getInstance(q);
1402
1403 qPos.add(classNameId);
1404
1405 count = (Long)q.uniqueResult();
1406 }
1407 catch (Exception e) {
1408 throw processException(e);
1409 }
1410 finally {
1411 if (count == null) {
1412 count = Long.valueOf(0);
1413 }
1414
1415 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1416 finderArgs, count);
1417
1418 closeSession(session);
1419 }
1420 }
1421
1422 return count.intValue();
1423 }
1424
1425
1432 public int countByThreadId(long threadId) throws SystemException {
1433 Object[] finderArgs = new Object[] { threadId };
1434
1435 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THREADID,
1436 finderArgs, this);
1437
1438 if (count == null) {
1439 StringBundler query = new StringBundler(2);
1440
1441 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1442
1443 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1444
1445 String sql = query.toString();
1446
1447 Session session = null;
1448
1449 try {
1450 session = openSession();
1451
1452 Query q = session.createQuery(sql);
1453
1454 QueryPos qPos = QueryPos.getInstance(q);
1455
1456 qPos.add(threadId);
1457
1458 count = (Long)q.uniqueResult();
1459 }
1460 catch (Exception e) {
1461 throw processException(e);
1462 }
1463 finally {
1464 if (count == null) {
1465 count = Long.valueOf(0);
1466 }
1467
1468 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADID,
1469 finderArgs, count);
1470
1471 closeSession(session);
1472 }
1473 }
1474
1475 return count.intValue();
1476 }
1477
1478
1486 public int countByC_C(long classNameId, long classPK)
1487 throws SystemException {
1488 Object[] finderArgs = new Object[] { classNameId, classPK };
1489
1490 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1491 finderArgs, this);
1492
1493 if (count == null) {
1494 StringBundler query = new StringBundler(3);
1495
1496 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1497
1498 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1499
1500 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1501
1502 String sql = query.toString();
1503
1504 Session session = null;
1505
1506 try {
1507 session = openSession();
1508
1509 Query q = session.createQuery(sql);
1510
1511 QueryPos qPos = QueryPos.getInstance(q);
1512
1513 qPos.add(classNameId);
1514
1515 qPos.add(classPK);
1516
1517 count = (Long)q.uniqueResult();
1518 }
1519 catch (Exception e) {
1520 throw processException(e);
1521 }
1522 finally {
1523 if (count == null) {
1524 count = Long.valueOf(0);
1525 }
1526
1527 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1528 count);
1529
1530 closeSession(session);
1531 }
1532 }
1533
1534 return count.intValue();
1535 }
1536
1537
1543 public int countAll() throws SystemException {
1544 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1545 FINDER_ARGS_EMPTY, this);
1546
1547 if (count == null) {
1548 Session session = null;
1549
1550 try {
1551 session = openSession();
1552
1553 Query q = session.createQuery(_SQL_COUNT_MBDISCUSSION);
1554
1555 count = (Long)q.uniqueResult();
1556 }
1557 catch (Exception e) {
1558 throw processException(e);
1559 }
1560 finally {
1561 if (count == null) {
1562 count = Long.valueOf(0);
1563 }
1564
1565 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1566 FINDER_ARGS_EMPTY, count);
1567
1568 closeSession(session);
1569 }
1570 }
1571
1572 return count.intValue();
1573 }
1574
1575
1578 public void afterPropertiesSet() {
1579 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1580 com.liferay.portal.util.PropsUtil.get(
1581 "value.object.listener.com.liferay.portlet.messageboards.model.MBDiscussion")));
1582
1583 if (listenerClassNames.length > 0) {
1584 try {
1585 List<ModelListener<MBDiscussion>> listenersList = new ArrayList<ModelListener<MBDiscussion>>();
1586
1587 for (String listenerClassName : listenerClassNames) {
1588 listenersList.add((ModelListener<MBDiscussion>)InstanceFactory.newInstance(
1589 listenerClassName));
1590 }
1591
1592 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1593 }
1594 catch (Exception e) {
1595 _log.error(e);
1596 }
1597 }
1598 }
1599
1600 public void destroy() {
1601 EntityCacheUtil.removeCache(MBDiscussionImpl.class.getName());
1602 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1603 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1604 }
1605
1606 @BeanReference(type = MBBanPersistence.class)
1607 protected MBBanPersistence mbBanPersistence;
1608 @BeanReference(type = MBCategoryPersistence.class)
1609 protected MBCategoryPersistence mbCategoryPersistence;
1610 @BeanReference(type = MBDiscussionPersistence.class)
1611 protected MBDiscussionPersistence mbDiscussionPersistence;
1612 @BeanReference(type = MBMailingListPersistence.class)
1613 protected MBMailingListPersistence mbMailingListPersistence;
1614 @BeanReference(type = MBMessagePersistence.class)
1615 protected MBMessagePersistence mbMessagePersistence;
1616 @BeanReference(type = MBStatsUserPersistence.class)
1617 protected MBStatsUserPersistence mbStatsUserPersistence;
1618 @BeanReference(type = MBThreadPersistence.class)
1619 protected MBThreadPersistence mbThreadPersistence;
1620 @BeanReference(type = MBThreadFlagPersistence.class)
1621 protected MBThreadFlagPersistence mbThreadFlagPersistence;
1622 @BeanReference(type = ResourcePersistence.class)
1623 protected ResourcePersistence resourcePersistence;
1624 @BeanReference(type = UserPersistence.class)
1625 protected UserPersistence userPersistence;
1626 private static final String _SQL_SELECT_MBDISCUSSION = "SELECT mbDiscussion FROM MBDiscussion mbDiscussion";
1627 private static final String _SQL_SELECT_MBDISCUSSION_WHERE = "SELECT mbDiscussion FROM MBDiscussion mbDiscussion WHERE ";
1628 private static final String _SQL_COUNT_MBDISCUSSION = "SELECT COUNT(mbDiscussion) FROM MBDiscussion mbDiscussion";
1629 private static final String _SQL_COUNT_MBDISCUSSION_WHERE = "SELECT COUNT(mbDiscussion) FROM MBDiscussion mbDiscussion WHERE ";
1630 private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "mbDiscussion.classNameId = ?";
1631 private static final String _FINDER_COLUMN_THREADID_THREADID_2 = "mbDiscussion.threadId = ?";
1632 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "mbDiscussion.classNameId = ? AND ";
1633 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "mbDiscussion.classPK = ?";
1634 private static final String _ORDER_BY_ENTITY_ALIAS = "mbDiscussion.";
1635 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No MBDiscussion exists with the primary key ";
1636 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No MBDiscussion exists with the key {";
1637 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1638 private static Log _log = LogFactoryUtil.getLog(MBDiscussionPersistenceImpl.class);
1639 private static MBDiscussion _nullMBDiscussion = new MBDiscussionImpl() {
1640 @Override
1641 public Object clone() {
1642 return this;
1643 }
1644
1645 @Override
1646 public CacheModel<MBDiscussion> toCacheModel() {
1647 return _nullMBDiscussionCacheModel;
1648 }
1649 };
1650
1651 private static CacheModel<MBDiscussion> _nullMBDiscussionCacheModel = new CacheModel<MBDiscussion>() {
1652 public MBDiscussion toEntityModel() {
1653 return _nullMBDiscussion;
1654 }
1655 };
1656 }