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 cacheUniqueFindersCache(MBDiscussion mbDiscussion) {
219 if (mbDiscussion.isNew()) {
220 Object[] args = new Object[] {
221 Long.valueOf(mbDiscussion.getThreadId())
222 };
223
224 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADID, args,
225 Long.valueOf(1));
226 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID, args,
227 mbDiscussion);
228
229 args = new Object[] {
230 Long.valueOf(mbDiscussion.getClassNameId()),
231 Long.valueOf(mbDiscussion.getClassPK())
232 };
233
234 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
235 Long.valueOf(1));
236 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
237 mbDiscussion);
238 }
239 else {
240 MBDiscussionModelImpl mbDiscussionModelImpl = (MBDiscussionModelImpl)mbDiscussion;
241
242 if ((mbDiscussionModelImpl.getColumnBitmask() &
243 FINDER_PATH_FETCH_BY_THREADID.getColumnBitmask()) != 0) {
244 Object[] args = new Object[] {
245 Long.valueOf(mbDiscussion.getThreadId())
246 };
247
248 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADID, args,
249 Long.valueOf(1));
250 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID, args,
251 mbDiscussion);
252 }
253
254 if ((mbDiscussionModelImpl.getColumnBitmask() &
255 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
256 Object[] args = new Object[] {
257 Long.valueOf(mbDiscussion.getClassNameId()),
258 Long.valueOf(mbDiscussion.getClassPK())
259 };
260
261 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, args,
262 Long.valueOf(1));
263 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C, args,
264 mbDiscussion);
265 }
266 }
267 }
268
269 protected void clearUniqueFindersCache(MBDiscussion mbDiscussion) {
270 MBDiscussionModelImpl mbDiscussionModelImpl = (MBDiscussionModelImpl)mbDiscussion;
271
272 Object[] args = new Object[] { Long.valueOf(mbDiscussion.getThreadId()) };
273
274 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_THREADID, args);
275 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID, args);
276
277 if ((mbDiscussionModelImpl.getColumnBitmask() &
278 FINDER_PATH_FETCH_BY_THREADID.getColumnBitmask()) != 0) {
279 args = new Object[] {
280 Long.valueOf(mbDiscussionModelImpl.getOriginalThreadId())
281 };
282
283 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_THREADID, args);
284 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID, args);
285 }
286
287 args = new Object[] {
288 Long.valueOf(mbDiscussion.getClassNameId()),
289 Long.valueOf(mbDiscussion.getClassPK())
290 };
291
292 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
293 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
294
295 if ((mbDiscussionModelImpl.getColumnBitmask() &
296 FINDER_PATH_FETCH_BY_C_C.getColumnBitmask()) != 0) {
297 args = new Object[] {
298 Long.valueOf(mbDiscussionModelImpl.getOriginalClassNameId()),
299 Long.valueOf(mbDiscussionModelImpl.getOriginalClassPK())
300 };
301
302 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
303 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C, args);
304 }
305 }
306
307
313 public MBDiscussion create(long discussionId) {
314 MBDiscussion mbDiscussion = new MBDiscussionImpl();
315
316 mbDiscussion.setNew(true);
317 mbDiscussion.setPrimaryKey(discussionId);
318
319 return mbDiscussion;
320 }
321
322
330 public MBDiscussion remove(long discussionId)
331 throws NoSuchDiscussionException, SystemException {
332 return remove(Long.valueOf(discussionId));
333 }
334
335
343 @Override
344 public MBDiscussion remove(Serializable primaryKey)
345 throws NoSuchDiscussionException, SystemException {
346 Session session = null;
347
348 try {
349 session = openSession();
350
351 MBDiscussion mbDiscussion = (MBDiscussion)session.get(MBDiscussionImpl.class,
352 primaryKey);
353
354 if (mbDiscussion == null) {
355 if (_log.isWarnEnabled()) {
356 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
357 }
358
359 throw new NoSuchDiscussionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
360 primaryKey);
361 }
362
363 return remove(mbDiscussion);
364 }
365 catch (NoSuchDiscussionException nsee) {
366 throw nsee;
367 }
368 catch (Exception e) {
369 throw processException(e);
370 }
371 finally {
372 closeSession(session);
373 }
374 }
375
376 @Override
377 protected MBDiscussion removeImpl(MBDiscussion mbDiscussion)
378 throws SystemException {
379 mbDiscussion = toUnwrappedModel(mbDiscussion);
380
381 Session session = null;
382
383 try {
384 session = openSession();
385
386 BatchSessionUtil.delete(session, mbDiscussion);
387 }
388 catch (Exception e) {
389 throw processException(e);
390 }
391 finally {
392 closeSession(session);
393 }
394
395 clearCache(mbDiscussion);
396
397 return mbDiscussion;
398 }
399
400 @Override
401 public MBDiscussion updateImpl(
402 com.liferay.portlet.messageboards.model.MBDiscussion mbDiscussion,
403 boolean merge) throws SystemException {
404 mbDiscussion = toUnwrappedModel(mbDiscussion);
405
406 boolean isNew = mbDiscussion.isNew();
407
408 MBDiscussionModelImpl mbDiscussionModelImpl = (MBDiscussionModelImpl)mbDiscussion;
409
410 Session session = null;
411
412 try {
413 session = openSession();
414
415 BatchSessionUtil.update(session, mbDiscussion, merge);
416
417 mbDiscussion.setNew(false);
418 }
419 catch (Exception e) {
420 throw processException(e);
421 }
422 finally {
423 closeSession(session);
424 }
425
426 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
427
428 if (isNew || !MBDiscussionModelImpl.COLUMN_BITMASK_ENABLED) {
429 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
430 }
431
432 else {
433 if ((mbDiscussionModelImpl.getColumnBitmask() &
434 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID.getColumnBitmask()) != 0) {
435 Object[] args = new Object[] {
436 Long.valueOf(mbDiscussionModelImpl.getOriginalClassNameId())
437 };
438
439 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
440 args);
441 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
442 args);
443
444 args = new Object[] {
445 Long.valueOf(mbDiscussionModelImpl.getClassNameId())
446 };
447
448 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
449 args);
450 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID,
451 args);
452 }
453 }
454
455 EntityCacheUtil.putResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
456 MBDiscussionImpl.class, mbDiscussion.getPrimaryKey(), mbDiscussion);
457
458 clearUniqueFindersCache(mbDiscussion);
459 cacheUniqueFindersCache(mbDiscussion);
460
461 return mbDiscussion;
462 }
463
464 protected MBDiscussion toUnwrappedModel(MBDiscussion mbDiscussion) {
465 if (mbDiscussion instanceof MBDiscussionImpl) {
466 return mbDiscussion;
467 }
468
469 MBDiscussionImpl mbDiscussionImpl = new MBDiscussionImpl();
470
471 mbDiscussionImpl.setNew(mbDiscussion.isNew());
472 mbDiscussionImpl.setPrimaryKey(mbDiscussion.getPrimaryKey());
473
474 mbDiscussionImpl.setDiscussionId(mbDiscussion.getDiscussionId());
475 mbDiscussionImpl.setClassNameId(mbDiscussion.getClassNameId());
476 mbDiscussionImpl.setClassPK(mbDiscussion.getClassPK());
477 mbDiscussionImpl.setThreadId(mbDiscussion.getThreadId());
478
479 return mbDiscussionImpl;
480 }
481
482
490 @Override
491 public MBDiscussion findByPrimaryKey(Serializable primaryKey)
492 throws NoSuchModelException, SystemException {
493 return findByPrimaryKey(((Long)primaryKey).longValue());
494 }
495
496
504 public MBDiscussion findByPrimaryKey(long discussionId)
505 throws NoSuchDiscussionException, SystemException {
506 MBDiscussion mbDiscussion = fetchByPrimaryKey(discussionId);
507
508 if (mbDiscussion == null) {
509 if (_log.isWarnEnabled()) {
510 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + discussionId);
511 }
512
513 throw new NoSuchDiscussionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
514 discussionId);
515 }
516
517 return mbDiscussion;
518 }
519
520
527 @Override
528 public MBDiscussion fetchByPrimaryKey(Serializable primaryKey)
529 throws SystemException {
530 return fetchByPrimaryKey(((Long)primaryKey).longValue());
531 }
532
533
540 public MBDiscussion fetchByPrimaryKey(long discussionId)
541 throws SystemException {
542 MBDiscussion mbDiscussion = (MBDiscussion)EntityCacheUtil.getResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
543 MBDiscussionImpl.class, discussionId);
544
545 if (mbDiscussion == _nullMBDiscussion) {
546 return null;
547 }
548
549 if (mbDiscussion == null) {
550 Session session = null;
551
552 boolean hasException = false;
553
554 try {
555 session = openSession();
556
557 mbDiscussion = (MBDiscussion)session.get(MBDiscussionImpl.class,
558 Long.valueOf(discussionId));
559 }
560 catch (Exception e) {
561 hasException = true;
562
563 throw processException(e);
564 }
565 finally {
566 if (mbDiscussion != null) {
567 cacheResult(mbDiscussion);
568 }
569 else if (!hasException) {
570 EntityCacheUtil.putResult(MBDiscussionModelImpl.ENTITY_CACHE_ENABLED,
571 MBDiscussionImpl.class, discussionId, _nullMBDiscussion);
572 }
573
574 closeSession(session);
575 }
576 }
577
578 return mbDiscussion;
579 }
580
581
588 public List<MBDiscussion> findByClassNameId(long classNameId)
589 throws SystemException {
590 return findByClassNameId(classNameId, QueryUtil.ALL_POS,
591 QueryUtil.ALL_POS, null);
592 }
593
594
607 public List<MBDiscussion> findByClassNameId(long classNameId, int start,
608 int end) throws SystemException {
609 return findByClassNameId(classNameId, start, end, null);
610 }
611
612
626 public List<MBDiscussion> findByClassNameId(long classNameId, int start,
627 int end, OrderByComparator orderByComparator) throws SystemException {
628 FinderPath finderPath = null;
629 Object[] finderArgs = null;
630
631 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
632 (orderByComparator == null)) {
633 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_CLASSNAMEID;
634 finderArgs = new Object[] { classNameId };
635 }
636 else {
637 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_CLASSNAMEID;
638 finderArgs = new Object[] { classNameId, start, end, orderByComparator };
639 }
640
641 List<MBDiscussion> list = (List<MBDiscussion>)FinderCacheUtil.getResult(finderPath,
642 finderArgs, this);
643
644 if ((list != null) && !list.isEmpty()) {
645 for (MBDiscussion mbDiscussion : list) {
646 if ((classNameId != mbDiscussion.getClassNameId())) {
647 list = null;
648
649 break;
650 }
651 }
652 }
653
654 if (list == null) {
655 StringBundler query = null;
656
657 if (orderByComparator != null) {
658 query = new StringBundler(3 +
659 (orderByComparator.getOrderByFields().length * 3));
660 }
661 else {
662 query = new StringBundler(2);
663 }
664
665 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
666
667 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
668
669 if (orderByComparator != null) {
670 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
671 orderByComparator);
672 }
673
674 String sql = query.toString();
675
676 Session session = null;
677
678 try {
679 session = openSession();
680
681 Query q = session.createQuery(sql);
682
683 QueryPos qPos = QueryPos.getInstance(q);
684
685 qPos.add(classNameId);
686
687 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
688 start, end);
689 }
690 catch (Exception e) {
691 throw processException(e);
692 }
693 finally {
694 if (list == null) {
695 FinderCacheUtil.removeResult(finderPath, finderArgs);
696 }
697 else {
698 cacheResult(list);
699
700 FinderCacheUtil.putResult(finderPath, finderArgs, list);
701 }
702
703 closeSession(session);
704 }
705 }
706
707 return list;
708 }
709
710
719 public MBDiscussion findByClassNameId_First(long classNameId,
720 OrderByComparator orderByComparator)
721 throws NoSuchDiscussionException, SystemException {
722 MBDiscussion mbDiscussion = fetchByClassNameId_First(classNameId,
723 orderByComparator);
724
725 if (mbDiscussion != null) {
726 return mbDiscussion;
727 }
728
729 StringBundler msg = new StringBundler(4);
730
731 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
732
733 msg.append("classNameId=");
734 msg.append(classNameId);
735
736 msg.append(StringPool.CLOSE_CURLY_BRACE);
737
738 throw new NoSuchDiscussionException(msg.toString());
739 }
740
741
749 public MBDiscussion fetchByClassNameId_First(long classNameId,
750 OrderByComparator orderByComparator) throws SystemException {
751 List<MBDiscussion> list = findByClassNameId(classNameId, 0, 1,
752 orderByComparator);
753
754 if (!list.isEmpty()) {
755 return list.get(0);
756 }
757
758 return null;
759 }
760
761
770 public MBDiscussion findByClassNameId_Last(long classNameId,
771 OrderByComparator orderByComparator)
772 throws NoSuchDiscussionException, SystemException {
773 MBDiscussion mbDiscussion = fetchByClassNameId_Last(classNameId,
774 orderByComparator);
775
776 if (mbDiscussion != null) {
777 return mbDiscussion;
778 }
779
780 StringBundler msg = new StringBundler(4);
781
782 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
783
784 msg.append("classNameId=");
785 msg.append(classNameId);
786
787 msg.append(StringPool.CLOSE_CURLY_BRACE);
788
789 throw new NoSuchDiscussionException(msg.toString());
790 }
791
792
800 public MBDiscussion fetchByClassNameId_Last(long classNameId,
801 OrderByComparator orderByComparator) throws SystemException {
802 int count = countByClassNameId(classNameId);
803
804 List<MBDiscussion> list = findByClassNameId(classNameId, count - 1,
805 count, orderByComparator);
806
807 if (!list.isEmpty()) {
808 return list.get(0);
809 }
810
811 return null;
812 }
813
814
824 public MBDiscussion[] findByClassNameId_PrevAndNext(long discussionId,
825 long classNameId, OrderByComparator orderByComparator)
826 throws NoSuchDiscussionException, SystemException {
827 MBDiscussion mbDiscussion = findByPrimaryKey(discussionId);
828
829 Session session = null;
830
831 try {
832 session = openSession();
833
834 MBDiscussion[] array = new MBDiscussionImpl[3];
835
836 array[0] = getByClassNameId_PrevAndNext(session, mbDiscussion,
837 classNameId, orderByComparator, true);
838
839 array[1] = mbDiscussion;
840
841 array[2] = getByClassNameId_PrevAndNext(session, mbDiscussion,
842 classNameId, orderByComparator, false);
843
844 return array;
845 }
846 catch (Exception e) {
847 throw processException(e);
848 }
849 finally {
850 closeSession(session);
851 }
852 }
853
854 protected MBDiscussion getByClassNameId_PrevAndNext(Session session,
855 MBDiscussion mbDiscussion, long classNameId,
856 OrderByComparator orderByComparator, boolean previous) {
857 StringBundler query = null;
858
859 if (orderByComparator != null) {
860 query = new StringBundler(6 +
861 (orderByComparator.getOrderByFields().length * 6));
862 }
863 else {
864 query = new StringBundler(3);
865 }
866
867 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
868
869 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
870
871 if (orderByComparator != null) {
872 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
873
874 if (orderByConditionFields.length > 0) {
875 query.append(WHERE_AND);
876 }
877
878 for (int i = 0; i < orderByConditionFields.length; i++) {
879 query.append(_ORDER_BY_ENTITY_ALIAS);
880 query.append(orderByConditionFields[i]);
881
882 if ((i + 1) < orderByConditionFields.length) {
883 if (orderByComparator.isAscending() ^ previous) {
884 query.append(WHERE_GREATER_THAN_HAS_NEXT);
885 }
886 else {
887 query.append(WHERE_LESSER_THAN_HAS_NEXT);
888 }
889 }
890 else {
891 if (orderByComparator.isAscending() ^ previous) {
892 query.append(WHERE_GREATER_THAN);
893 }
894 else {
895 query.append(WHERE_LESSER_THAN);
896 }
897 }
898 }
899
900 query.append(ORDER_BY_CLAUSE);
901
902 String[] orderByFields = orderByComparator.getOrderByFields();
903
904 for (int i = 0; i < orderByFields.length; i++) {
905 query.append(_ORDER_BY_ENTITY_ALIAS);
906 query.append(orderByFields[i]);
907
908 if ((i + 1) < orderByFields.length) {
909 if (orderByComparator.isAscending() ^ previous) {
910 query.append(ORDER_BY_ASC_HAS_NEXT);
911 }
912 else {
913 query.append(ORDER_BY_DESC_HAS_NEXT);
914 }
915 }
916 else {
917 if (orderByComparator.isAscending() ^ previous) {
918 query.append(ORDER_BY_ASC);
919 }
920 else {
921 query.append(ORDER_BY_DESC);
922 }
923 }
924 }
925 }
926
927 String sql = query.toString();
928
929 Query q = session.createQuery(sql);
930
931 q.setFirstResult(0);
932 q.setMaxResults(2);
933
934 QueryPos qPos = QueryPos.getInstance(q);
935
936 qPos.add(classNameId);
937
938 if (orderByComparator != null) {
939 Object[] values = orderByComparator.getOrderByConditionValues(mbDiscussion);
940
941 for (Object value : values) {
942 qPos.add(value);
943 }
944 }
945
946 List<MBDiscussion> list = q.list();
947
948 if (list.size() == 2) {
949 return list.get(1);
950 }
951 else {
952 return null;
953 }
954 }
955
956
964 public MBDiscussion findByThreadId(long threadId)
965 throws NoSuchDiscussionException, SystemException {
966 MBDiscussion mbDiscussion = fetchByThreadId(threadId);
967
968 if (mbDiscussion == null) {
969 StringBundler msg = new StringBundler(4);
970
971 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
972
973 msg.append("threadId=");
974 msg.append(threadId);
975
976 msg.append(StringPool.CLOSE_CURLY_BRACE);
977
978 if (_log.isWarnEnabled()) {
979 _log.warn(msg.toString());
980 }
981
982 throw new NoSuchDiscussionException(msg.toString());
983 }
984
985 return mbDiscussion;
986 }
987
988
995 public MBDiscussion fetchByThreadId(long threadId)
996 throws SystemException {
997 return fetchByThreadId(threadId, true);
998 }
999
1000
1008 public MBDiscussion fetchByThreadId(long threadId, boolean retrieveFromCache)
1009 throws SystemException {
1010 Object[] finderArgs = new Object[] { threadId };
1011
1012 Object result = null;
1013
1014 if (retrieveFromCache) {
1015 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_THREADID,
1016 finderArgs, this);
1017 }
1018
1019 if (result instanceof MBDiscussion) {
1020 MBDiscussion mbDiscussion = (MBDiscussion)result;
1021
1022 if ((threadId != mbDiscussion.getThreadId())) {
1023 result = null;
1024 }
1025 }
1026
1027 if (result == null) {
1028 StringBundler query = new StringBundler(2);
1029
1030 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
1031
1032 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1033
1034 String sql = query.toString();
1035
1036 Session session = null;
1037
1038 try {
1039 session = openSession();
1040
1041 Query q = session.createQuery(sql);
1042
1043 QueryPos qPos = QueryPos.getInstance(q);
1044
1045 qPos.add(threadId);
1046
1047 List<MBDiscussion> list = q.list();
1048
1049 result = list;
1050
1051 MBDiscussion mbDiscussion = null;
1052
1053 if (list.isEmpty()) {
1054 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
1055 finderArgs, list);
1056 }
1057 else {
1058 mbDiscussion = list.get(0);
1059
1060 cacheResult(mbDiscussion);
1061
1062 if ((mbDiscussion.getThreadId() != threadId)) {
1063 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THREADID,
1064 finderArgs, mbDiscussion);
1065 }
1066 }
1067
1068 return mbDiscussion;
1069 }
1070 catch (Exception e) {
1071 throw processException(e);
1072 }
1073 finally {
1074 if (result == null) {
1075 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THREADID,
1076 finderArgs);
1077 }
1078
1079 closeSession(session);
1080 }
1081 }
1082 else {
1083 if (result instanceof List<?>) {
1084 return null;
1085 }
1086 else {
1087 return (MBDiscussion)result;
1088 }
1089 }
1090 }
1091
1092
1101 public MBDiscussion findByC_C(long classNameId, long classPK)
1102 throws NoSuchDiscussionException, SystemException {
1103 MBDiscussion mbDiscussion = fetchByC_C(classNameId, classPK);
1104
1105 if (mbDiscussion == null) {
1106 StringBundler msg = new StringBundler(6);
1107
1108 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1109
1110 msg.append("classNameId=");
1111 msg.append(classNameId);
1112
1113 msg.append(", classPK=");
1114 msg.append(classPK);
1115
1116 msg.append(StringPool.CLOSE_CURLY_BRACE);
1117
1118 if (_log.isWarnEnabled()) {
1119 _log.warn(msg.toString());
1120 }
1121
1122 throw new NoSuchDiscussionException(msg.toString());
1123 }
1124
1125 return mbDiscussion;
1126 }
1127
1128
1136 public MBDiscussion fetchByC_C(long classNameId, long classPK)
1137 throws SystemException {
1138 return fetchByC_C(classNameId, classPK, true);
1139 }
1140
1141
1150 public MBDiscussion fetchByC_C(long classNameId, long classPK,
1151 boolean retrieveFromCache) throws SystemException {
1152 Object[] finderArgs = new Object[] { classNameId, classPK };
1153
1154 Object result = null;
1155
1156 if (retrieveFromCache) {
1157 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_C,
1158 finderArgs, this);
1159 }
1160
1161 if (result instanceof MBDiscussion) {
1162 MBDiscussion mbDiscussion = (MBDiscussion)result;
1163
1164 if ((classNameId != mbDiscussion.getClassNameId()) ||
1165 (classPK != mbDiscussion.getClassPK())) {
1166 result = null;
1167 }
1168 }
1169
1170 if (result == null) {
1171 StringBundler query = new StringBundler(3);
1172
1173 query.append(_SQL_SELECT_MBDISCUSSION_WHERE);
1174
1175 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1176
1177 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1178
1179 String sql = query.toString();
1180
1181 Session session = null;
1182
1183 try {
1184 session = openSession();
1185
1186 Query q = session.createQuery(sql);
1187
1188 QueryPos qPos = QueryPos.getInstance(q);
1189
1190 qPos.add(classNameId);
1191
1192 qPos.add(classPK);
1193
1194 List<MBDiscussion> list = q.list();
1195
1196 result = list;
1197
1198 MBDiscussion mbDiscussion = null;
1199
1200 if (list.isEmpty()) {
1201 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1202 finderArgs, list);
1203 }
1204 else {
1205 mbDiscussion = list.get(0);
1206
1207 cacheResult(mbDiscussion);
1208
1209 if ((mbDiscussion.getClassNameId() != classNameId) ||
1210 (mbDiscussion.getClassPK() != classPK)) {
1211 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_C,
1212 finderArgs, mbDiscussion);
1213 }
1214 }
1215
1216 return mbDiscussion;
1217 }
1218 catch (Exception e) {
1219 throw processException(e);
1220 }
1221 finally {
1222 if (result == null) {
1223 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_C,
1224 finderArgs);
1225 }
1226
1227 closeSession(session);
1228 }
1229 }
1230 else {
1231 if (result instanceof List<?>) {
1232 return null;
1233 }
1234 else {
1235 return (MBDiscussion)result;
1236 }
1237 }
1238 }
1239
1240
1246 public List<MBDiscussion> findAll() throws SystemException {
1247 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1248 }
1249
1250
1262 public List<MBDiscussion> findAll(int start, int end)
1263 throws SystemException {
1264 return findAll(start, end, null);
1265 }
1266
1267
1280 public List<MBDiscussion> findAll(int start, int end,
1281 OrderByComparator orderByComparator) throws SystemException {
1282 FinderPath finderPath = null;
1283 Object[] finderArgs = new Object[] { start, end, orderByComparator };
1284
1285 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1286 (orderByComparator == null)) {
1287 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1288 finderArgs = FINDER_ARGS_EMPTY;
1289 }
1290 else {
1291 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1292 finderArgs = new Object[] { start, end, orderByComparator };
1293 }
1294
1295 List<MBDiscussion> list = (List<MBDiscussion>)FinderCacheUtil.getResult(finderPath,
1296 finderArgs, this);
1297
1298 if (list == null) {
1299 StringBundler query = null;
1300 String sql = null;
1301
1302 if (orderByComparator != null) {
1303 query = new StringBundler(2 +
1304 (orderByComparator.getOrderByFields().length * 3));
1305
1306 query.append(_SQL_SELECT_MBDISCUSSION);
1307
1308 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1309 orderByComparator);
1310
1311 sql = query.toString();
1312 }
1313 else {
1314 sql = _SQL_SELECT_MBDISCUSSION;
1315 }
1316
1317 Session session = null;
1318
1319 try {
1320 session = openSession();
1321
1322 Query q = session.createQuery(sql);
1323
1324 if (orderByComparator == null) {
1325 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
1326 start, end, false);
1327
1328 Collections.sort(list);
1329 }
1330 else {
1331 list = (List<MBDiscussion>)QueryUtil.list(q, getDialect(),
1332 start, end);
1333 }
1334 }
1335 catch (Exception e) {
1336 throw processException(e);
1337 }
1338 finally {
1339 if (list == null) {
1340 FinderCacheUtil.removeResult(finderPath, finderArgs);
1341 }
1342 else {
1343 cacheResult(list);
1344
1345 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1346 }
1347
1348 closeSession(session);
1349 }
1350 }
1351
1352 return list;
1353 }
1354
1355
1361 public void removeByClassNameId(long classNameId) throws SystemException {
1362 for (MBDiscussion mbDiscussion : findByClassNameId(classNameId)) {
1363 remove(mbDiscussion);
1364 }
1365 }
1366
1367
1374 public MBDiscussion removeByThreadId(long threadId)
1375 throws NoSuchDiscussionException, SystemException {
1376 MBDiscussion mbDiscussion = findByThreadId(threadId);
1377
1378 return remove(mbDiscussion);
1379 }
1380
1381
1389 public MBDiscussion removeByC_C(long classNameId, long classPK)
1390 throws NoSuchDiscussionException, SystemException {
1391 MBDiscussion mbDiscussion = findByC_C(classNameId, classPK);
1392
1393 return remove(mbDiscussion);
1394 }
1395
1396
1401 public void removeAll() throws SystemException {
1402 for (MBDiscussion mbDiscussion : findAll()) {
1403 remove(mbDiscussion);
1404 }
1405 }
1406
1407
1414 public int countByClassNameId(long classNameId) throws SystemException {
1415 Object[] finderArgs = new Object[] { classNameId };
1416
1417 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1418 finderArgs, this);
1419
1420 if (count == null) {
1421 StringBundler query = new StringBundler(2);
1422
1423 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1424
1425 query.append(_FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2);
1426
1427 String sql = query.toString();
1428
1429 Session session = null;
1430
1431 try {
1432 session = openSession();
1433
1434 Query q = session.createQuery(sql);
1435
1436 QueryPos qPos = QueryPos.getInstance(q);
1437
1438 qPos.add(classNameId);
1439
1440 count = (Long)q.uniqueResult();
1441 }
1442 catch (Exception e) {
1443 throw processException(e);
1444 }
1445 finally {
1446 if (count == null) {
1447 count = Long.valueOf(0);
1448 }
1449
1450 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CLASSNAMEID,
1451 finderArgs, count);
1452
1453 closeSession(session);
1454 }
1455 }
1456
1457 return count.intValue();
1458 }
1459
1460
1467 public int countByThreadId(long threadId) throws SystemException {
1468 Object[] finderArgs = new Object[] { threadId };
1469
1470 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THREADID,
1471 finderArgs, this);
1472
1473 if (count == null) {
1474 StringBundler query = new StringBundler(2);
1475
1476 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1477
1478 query.append(_FINDER_COLUMN_THREADID_THREADID_2);
1479
1480 String sql = query.toString();
1481
1482 Session session = null;
1483
1484 try {
1485 session = openSession();
1486
1487 Query q = session.createQuery(sql);
1488
1489 QueryPos qPos = QueryPos.getInstance(q);
1490
1491 qPos.add(threadId);
1492
1493 count = (Long)q.uniqueResult();
1494 }
1495 catch (Exception e) {
1496 throw processException(e);
1497 }
1498 finally {
1499 if (count == null) {
1500 count = Long.valueOf(0);
1501 }
1502
1503 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THREADID,
1504 finderArgs, count);
1505
1506 closeSession(session);
1507 }
1508 }
1509
1510 return count.intValue();
1511 }
1512
1513
1521 public int countByC_C(long classNameId, long classPK)
1522 throws SystemException {
1523 Object[] finderArgs = new Object[] { classNameId, classPK };
1524
1525 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
1526 finderArgs, this);
1527
1528 if (count == null) {
1529 StringBundler query = new StringBundler(3);
1530
1531 query.append(_SQL_COUNT_MBDISCUSSION_WHERE);
1532
1533 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
1534
1535 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
1536
1537 String sql = query.toString();
1538
1539 Session session = null;
1540
1541 try {
1542 session = openSession();
1543
1544 Query q = session.createQuery(sql);
1545
1546 QueryPos qPos = QueryPos.getInstance(q);
1547
1548 qPos.add(classNameId);
1549
1550 qPos.add(classPK);
1551
1552 count = (Long)q.uniqueResult();
1553 }
1554 catch (Exception e) {
1555 throw processException(e);
1556 }
1557 finally {
1558 if (count == null) {
1559 count = Long.valueOf(0);
1560 }
1561
1562 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
1563 count);
1564
1565 closeSession(session);
1566 }
1567 }
1568
1569 return count.intValue();
1570 }
1571
1572
1578 public int countAll() throws SystemException {
1579 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1580 FINDER_ARGS_EMPTY, this);
1581
1582 if (count == null) {
1583 Session session = null;
1584
1585 try {
1586 session = openSession();
1587
1588 Query q = session.createQuery(_SQL_COUNT_MBDISCUSSION);
1589
1590 count = (Long)q.uniqueResult();
1591 }
1592 catch (Exception e) {
1593 throw processException(e);
1594 }
1595 finally {
1596 if (count == null) {
1597 count = Long.valueOf(0);
1598 }
1599
1600 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1601 FINDER_ARGS_EMPTY, count);
1602
1603 closeSession(session);
1604 }
1605 }
1606
1607 return count.intValue();
1608 }
1609
1610
1613 public void afterPropertiesSet() {
1614 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1615 com.liferay.portal.util.PropsUtil.get(
1616 "value.object.listener.com.liferay.portlet.messageboards.model.MBDiscussion")));
1617
1618 if (listenerClassNames.length > 0) {
1619 try {
1620 List<ModelListener<MBDiscussion>> listenersList = new ArrayList<ModelListener<MBDiscussion>>();
1621
1622 for (String listenerClassName : listenerClassNames) {
1623 Class<?> clazz = getClass();
1624
1625 listenersList.add((ModelListener<MBDiscussion>)InstanceFactory.newInstance(
1626 clazz.getClassLoader(), listenerClassName));
1627 }
1628
1629 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1630 }
1631 catch (Exception e) {
1632 _log.error(e);
1633 }
1634 }
1635 }
1636
1637 public void destroy() {
1638 EntityCacheUtil.removeCache(MBDiscussionImpl.class.getName());
1639 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1640 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1641 }
1642
1643 @BeanReference(type = MBBanPersistence.class)
1644 protected MBBanPersistence mbBanPersistence;
1645 @BeanReference(type = MBCategoryPersistence.class)
1646 protected MBCategoryPersistence mbCategoryPersistence;
1647 @BeanReference(type = MBDiscussionPersistence.class)
1648 protected MBDiscussionPersistence mbDiscussionPersistence;
1649 @BeanReference(type = MBMailingListPersistence.class)
1650 protected MBMailingListPersistence mbMailingListPersistence;
1651 @BeanReference(type = MBMessagePersistence.class)
1652 protected MBMessagePersistence mbMessagePersistence;
1653 @BeanReference(type = MBStatsUserPersistence.class)
1654 protected MBStatsUserPersistence mbStatsUserPersistence;
1655 @BeanReference(type = MBThreadPersistence.class)
1656 protected MBThreadPersistence mbThreadPersistence;
1657 @BeanReference(type = MBThreadFlagPersistence.class)
1658 protected MBThreadFlagPersistence mbThreadFlagPersistence;
1659 @BeanReference(type = ResourcePersistence.class)
1660 protected ResourcePersistence resourcePersistence;
1661 @BeanReference(type = UserPersistence.class)
1662 protected UserPersistence userPersistence;
1663 private static final String _SQL_SELECT_MBDISCUSSION = "SELECT mbDiscussion FROM MBDiscussion mbDiscussion";
1664 private static final String _SQL_SELECT_MBDISCUSSION_WHERE = "SELECT mbDiscussion FROM MBDiscussion mbDiscussion WHERE ";
1665 private static final String _SQL_COUNT_MBDISCUSSION = "SELECT COUNT(mbDiscussion) FROM MBDiscussion mbDiscussion";
1666 private static final String _SQL_COUNT_MBDISCUSSION_WHERE = "SELECT COUNT(mbDiscussion) FROM MBDiscussion mbDiscussion WHERE ";
1667 private static final String _FINDER_COLUMN_CLASSNAMEID_CLASSNAMEID_2 = "mbDiscussion.classNameId = ?";
1668 private static final String _FINDER_COLUMN_THREADID_THREADID_2 = "mbDiscussion.threadId = ?";
1669 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "mbDiscussion.classNameId = ? AND ";
1670 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "mbDiscussion.classPK = ?";
1671 private static final String _ORDER_BY_ENTITY_ALIAS = "mbDiscussion.";
1672 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No MBDiscussion exists with the primary key ";
1673 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No MBDiscussion exists with the key {";
1674 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1675 private static Log _log = LogFactoryUtil.getLog(MBDiscussionPersistenceImpl.class);
1676 private static MBDiscussion _nullMBDiscussion = new MBDiscussionImpl() {
1677 @Override
1678 public Object clone() {
1679 return this;
1680 }
1681
1682 @Override
1683 public CacheModel<MBDiscussion> toCacheModel() {
1684 return _nullMBDiscussionCacheModel;
1685 }
1686 };
1687
1688 private static CacheModel<MBDiscussion> _nullMBDiscussionCacheModel = new CacheModel<MBDiscussion>() {
1689 public MBDiscussion toEntityModel() {
1690 return _nullMBDiscussion;
1691 }
1692 };
1693 }