001
014
015 package com.liferay.portlet.dynamicdatamapping.service.persistence.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
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.log.Log;
028 import com.liferay.portal.kernel.log.LogFactoryUtil;
029 import com.liferay.portal.kernel.util.OrderByComparator;
030 import com.liferay.portal.kernel.util.SetUtil;
031 import com.liferay.portal.kernel.util.StringBundler;
032 import com.liferay.portal.kernel.util.StringPool;
033 import com.liferay.portal.kernel.util.Validator;
034 import com.liferay.portal.model.CacheModel;
035 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
036
037 import com.liferay.portlet.dynamicdatamapping.NoSuchStructureVersionException;
038 import com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion;
039 import com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureVersionImpl;
040 import com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureVersionModelImpl;
041 import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureVersionPersistence;
042
043 import java.io.Serializable;
044
045 import java.util.Collections;
046 import java.util.HashMap;
047 import java.util.HashSet;
048 import java.util.Iterator;
049 import java.util.List;
050 import java.util.Map;
051 import java.util.Set;
052
053
065 @ProviderType
066 public class DDMStructureVersionPersistenceImpl extends BasePersistenceImpl<DDMStructureVersion>
067 implements DDMStructureVersionPersistence {
068
073 public static final String FINDER_CLASS_NAME_ENTITY = DDMStructureVersionImpl.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_ALL = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
079 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED,
080 DDMStructureVersionImpl.class,
081 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
082 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
083 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED,
084 DDMStructureVersionImpl.class,
085 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
086 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
087 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
088 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
089 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID =
090 new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
091 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED,
092 DDMStructureVersionImpl.class,
093 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByStructureId",
094 new String[] {
095 Long.class.getName(),
096
097 Integer.class.getName(), Integer.class.getName(),
098 OrderByComparator.class.getName()
099 });
100 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID =
101 new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
102 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED,
103 DDMStructureVersionImpl.class,
104 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByStructureId",
105 new String[] { Long.class.getName() },
106 DDMStructureVersionModelImpl.STRUCTUREID_COLUMN_BITMASK);
107 public static final FinderPath FINDER_PATH_COUNT_BY_STRUCTUREID = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
108 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByStructureId",
110 new String[] { Long.class.getName() });
111
112
118 @Override
119 public List<DDMStructureVersion> findByStructureId(long structureId) {
120 return findByStructureId(structureId, QueryUtil.ALL_POS,
121 QueryUtil.ALL_POS, null);
122 }
123
124
136 @Override
137 public List<DDMStructureVersion> findByStructureId(long structureId,
138 int start, int end) {
139 return findByStructureId(structureId, start, end, null);
140 }
141
142
155 @Override
156 public List<DDMStructureVersion> findByStructureId(long structureId,
157 int start, int end,
158 OrderByComparator<DDMStructureVersion> orderByComparator) {
159 boolean pagination = true;
160 FinderPath finderPath = null;
161 Object[] finderArgs = null;
162
163 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
164 (orderByComparator == null)) {
165 pagination = false;
166 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID;
167 finderArgs = new Object[] { structureId };
168 }
169 else {
170 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_STRUCTUREID;
171 finderArgs = new Object[] { structureId, start, end, orderByComparator };
172 }
173
174 List<DDMStructureVersion> list = (List<DDMStructureVersion>)FinderCacheUtil.getResult(finderPath,
175 finderArgs, this);
176
177 if ((list != null) && !list.isEmpty()) {
178 for (DDMStructureVersion ddmStructureVersion : list) {
179 if ((structureId != ddmStructureVersion.getStructureId())) {
180 list = null;
181
182 break;
183 }
184 }
185 }
186
187 if (list == null) {
188 StringBundler query = null;
189
190 if (orderByComparator != null) {
191 query = new StringBundler(3 +
192 (orderByComparator.getOrderByFields().length * 3));
193 }
194 else {
195 query = new StringBundler(3);
196 }
197
198 query.append(_SQL_SELECT_DDMSTRUCTUREVERSION_WHERE);
199
200 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
201
202 if (orderByComparator != null) {
203 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
204 orderByComparator);
205 }
206 else
207 if (pagination) {
208 query.append(DDMStructureVersionModelImpl.ORDER_BY_JPQL);
209 }
210
211 String sql = query.toString();
212
213 Session session = null;
214
215 try {
216 session = openSession();
217
218 Query q = session.createQuery(sql);
219
220 QueryPos qPos = QueryPos.getInstance(q);
221
222 qPos.add(structureId);
223
224 if (!pagination) {
225 list = (List<DDMStructureVersion>)QueryUtil.list(q,
226 getDialect(), start, end, false);
227
228 Collections.sort(list);
229
230 list = Collections.unmodifiableList(list);
231 }
232 else {
233 list = (List<DDMStructureVersion>)QueryUtil.list(q,
234 getDialect(), start, end);
235 }
236
237 cacheResult(list);
238
239 FinderCacheUtil.putResult(finderPath, finderArgs, list);
240 }
241 catch (Exception e) {
242 FinderCacheUtil.removeResult(finderPath, finderArgs);
243
244 throw processException(e);
245 }
246 finally {
247 closeSession(session);
248 }
249 }
250
251 return list;
252 }
253
254
262 @Override
263 public DDMStructureVersion findByStructureId_First(long structureId,
264 OrderByComparator<DDMStructureVersion> orderByComparator)
265 throws NoSuchStructureVersionException {
266 DDMStructureVersion ddmStructureVersion = fetchByStructureId_First(structureId,
267 orderByComparator);
268
269 if (ddmStructureVersion != null) {
270 return ddmStructureVersion;
271 }
272
273 StringBundler msg = new StringBundler(4);
274
275 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
276
277 msg.append("structureId=");
278 msg.append(structureId);
279
280 msg.append(StringPool.CLOSE_CURLY_BRACE);
281
282 throw new NoSuchStructureVersionException(msg.toString());
283 }
284
285
292 @Override
293 public DDMStructureVersion fetchByStructureId_First(long structureId,
294 OrderByComparator<DDMStructureVersion> orderByComparator) {
295 List<DDMStructureVersion> list = findByStructureId(structureId, 0, 1,
296 orderByComparator);
297
298 if (!list.isEmpty()) {
299 return list.get(0);
300 }
301
302 return null;
303 }
304
305
313 @Override
314 public DDMStructureVersion findByStructureId_Last(long structureId,
315 OrderByComparator<DDMStructureVersion> orderByComparator)
316 throws NoSuchStructureVersionException {
317 DDMStructureVersion ddmStructureVersion = fetchByStructureId_Last(structureId,
318 orderByComparator);
319
320 if (ddmStructureVersion != null) {
321 return ddmStructureVersion;
322 }
323
324 StringBundler msg = new StringBundler(4);
325
326 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
327
328 msg.append("structureId=");
329 msg.append(structureId);
330
331 msg.append(StringPool.CLOSE_CURLY_BRACE);
332
333 throw new NoSuchStructureVersionException(msg.toString());
334 }
335
336
343 @Override
344 public DDMStructureVersion fetchByStructureId_Last(long structureId,
345 OrderByComparator<DDMStructureVersion> orderByComparator) {
346 int count = countByStructureId(structureId);
347
348 if (count == 0) {
349 return null;
350 }
351
352 List<DDMStructureVersion> list = findByStructureId(structureId,
353 count - 1, count, orderByComparator);
354
355 if (!list.isEmpty()) {
356 return list.get(0);
357 }
358
359 return null;
360 }
361
362
371 @Override
372 public DDMStructureVersion[] findByStructureId_PrevAndNext(
373 long structureVersionId, long structureId,
374 OrderByComparator<DDMStructureVersion> orderByComparator)
375 throws NoSuchStructureVersionException {
376 DDMStructureVersion ddmStructureVersion = findByPrimaryKey(structureVersionId);
377
378 Session session = null;
379
380 try {
381 session = openSession();
382
383 DDMStructureVersion[] array = new DDMStructureVersionImpl[3];
384
385 array[0] = getByStructureId_PrevAndNext(session,
386 ddmStructureVersion, structureId, orderByComparator, true);
387
388 array[1] = ddmStructureVersion;
389
390 array[2] = getByStructureId_PrevAndNext(session,
391 ddmStructureVersion, structureId, orderByComparator, false);
392
393 return array;
394 }
395 catch (Exception e) {
396 throw processException(e);
397 }
398 finally {
399 closeSession(session);
400 }
401 }
402
403 protected DDMStructureVersion getByStructureId_PrevAndNext(
404 Session session, DDMStructureVersion ddmStructureVersion,
405 long structureId,
406 OrderByComparator<DDMStructureVersion> orderByComparator,
407 boolean previous) {
408 StringBundler query = null;
409
410 if (orderByComparator != null) {
411 query = new StringBundler(6 +
412 (orderByComparator.getOrderByFields().length * 6));
413 }
414 else {
415 query = new StringBundler(3);
416 }
417
418 query.append(_SQL_SELECT_DDMSTRUCTUREVERSION_WHERE);
419
420 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
421
422 if (orderByComparator != null) {
423 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
424
425 if (orderByConditionFields.length > 0) {
426 query.append(WHERE_AND);
427 }
428
429 for (int i = 0; i < orderByConditionFields.length; i++) {
430 query.append(_ORDER_BY_ENTITY_ALIAS);
431 query.append(orderByConditionFields[i]);
432
433 if ((i + 1) < orderByConditionFields.length) {
434 if (orderByComparator.isAscending() ^ previous) {
435 query.append(WHERE_GREATER_THAN_HAS_NEXT);
436 }
437 else {
438 query.append(WHERE_LESSER_THAN_HAS_NEXT);
439 }
440 }
441 else {
442 if (orderByComparator.isAscending() ^ previous) {
443 query.append(WHERE_GREATER_THAN);
444 }
445 else {
446 query.append(WHERE_LESSER_THAN);
447 }
448 }
449 }
450
451 query.append(ORDER_BY_CLAUSE);
452
453 String[] orderByFields = orderByComparator.getOrderByFields();
454
455 for (int i = 0; i < orderByFields.length; i++) {
456 query.append(_ORDER_BY_ENTITY_ALIAS);
457 query.append(orderByFields[i]);
458
459 if ((i + 1) < orderByFields.length) {
460 if (orderByComparator.isAscending() ^ previous) {
461 query.append(ORDER_BY_ASC_HAS_NEXT);
462 }
463 else {
464 query.append(ORDER_BY_DESC_HAS_NEXT);
465 }
466 }
467 else {
468 if (orderByComparator.isAscending() ^ previous) {
469 query.append(ORDER_BY_ASC);
470 }
471 else {
472 query.append(ORDER_BY_DESC);
473 }
474 }
475 }
476 }
477 else {
478 query.append(DDMStructureVersionModelImpl.ORDER_BY_JPQL);
479 }
480
481 String sql = query.toString();
482
483 Query q = session.createQuery(sql);
484
485 q.setFirstResult(0);
486 q.setMaxResults(2);
487
488 QueryPos qPos = QueryPos.getInstance(q);
489
490 qPos.add(structureId);
491
492 if (orderByComparator != null) {
493 Object[] values = orderByComparator.getOrderByConditionValues(ddmStructureVersion);
494
495 for (Object value : values) {
496 qPos.add(value);
497 }
498 }
499
500 List<DDMStructureVersion> list = q.list();
501
502 if (list.size() == 2) {
503 return list.get(1);
504 }
505 else {
506 return null;
507 }
508 }
509
510
515 @Override
516 public void removeByStructureId(long structureId) {
517 for (DDMStructureVersion ddmStructureVersion : findByStructureId(
518 structureId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
519 remove(ddmStructureVersion);
520 }
521 }
522
523
529 @Override
530 public int countByStructureId(long structureId) {
531 FinderPath finderPath = FINDER_PATH_COUNT_BY_STRUCTUREID;
532
533 Object[] finderArgs = new Object[] { structureId };
534
535 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
536 this);
537
538 if (count == null) {
539 StringBundler query = new StringBundler(2);
540
541 query.append(_SQL_COUNT_DDMSTRUCTUREVERSION_WHERE);
542
543 query.append(_FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2);
544
545 String sql = query.toString();
546
547 Session session = null;
548
549 try {
550 session = openSession();
551
552 Query q = session.createQuery(sql);
553
554 QueryPos qPos = QueryPos.getInstance(q);
555
556 qPos.add(structureId);
557
558 count = (Long)q.uniqueResult();
559
560 FinderCacheUtil.putResult(finderPath, finderArgs, count);
561 }
562 catch (Exception e) {
563 FinderCacheUtil.removeResult(finderPath, finderArgs);
564
565 throw processException(e);
566 }
567 finally {
568 closeSession(session);
569 }
570 }
571
572 return count.intValue();
573 }
574
575 private static final String _FINDER_COLUMN_STRUCTUREID_STRUCTUREID_2 = "ddmStructureVersion.structureId = ?";
576 public static final FinderPath FINDER_PATH_FETCH_BY_S_V = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
577 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED,
578 DDMStructureVersionImpl.class, FINDER_CLASS_NAME_ENTITY,
579 "fetchByS_V",
580 new String[] { Long.class.getName(), String.class.getName() },
581 DDMStructureVersionModelImpl.STRUCTUREID_COLUMN_BITMASK |
582 DDMStructureVersionModelImpl.VERSION_COLUMN_BITMASK);
583 public static final FinderPath FINDER_PATH_COUNT_BY_S_V = new FinderPath(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
584 DDMStructureVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
585 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByS_V",
586 new String[] { Long.class.getName(), String.class.getName() });
587
588
596 @Override
597 public DDMStructureVersion findByS_V(long structureId, String version)
598 throws NoSuchStructureVersionException {
599 DDMStructureVersion ddmStructureVersion = fetchByS_V(structureId,
600 version);
601
602 if (ddmStructureVersion == null) {
603 StringBundler msg = new StringBundler(6);
604
605 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
606
607 msg.append("structureId=");
608 msg.append(structureId);
609
610 msg.append(", version=");
611 msg.append(version);
612
613 msg.append(StringPool.CLOSE_CURLY_BRACE);
614
615 if (_log.isWarnEnabled()) {
616 _log.warn(msg.toString());
617 }
618
619 throw new NoSuchStructureVersionException(msg.toString());
620 }
621
622 return ddmStructureVersion;
623 }
624
625
632 @Override
633 public DDMStructureVersion fetchByS_V(long structureId, String version) {
634 return fetchByS_V(structureId, version, true);
635 }
636
637
645 @Override
646 public DDMStructureVersion fetchByS_V(long structureId, String version,
647 boolean retrieveFromCache) {
648 Object[] finderArgs = new Object[] { structureId, version };
649
650 Object result = null;
651
652 if (retrieveFromCache) {
653 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_S_V,
654 finderArgs, this);
655 }
656
657 if (result instanceof DDMStructureVersion) {
658 DDMStructureVersion ddmStructureVersion = (DDMStructureVersion)result;
659
660 if ((structureId != ddmStructureVersion.getStructureId()) ||
661 !Validator.equals(version, ddmStructureVersion.getVersion())) {
662 result = null;
663 }
664 }
665
666 if (result == null) {
667 StringBundler query = new StringBundler(4);
668
669 query.append(_SQL_SELECT_DDMSTRUCTUREVERSION_WHERE);
670
671 query.append(_FINDER_COLUMN_S_V_STRUCTUREID_2);
672
673 boolean bindVersion = false;
674
675 if (version == null) {
676 query.append(_FINDER_COLUMN_S_V_VERSION_1);
677 }
678 else if (version.equals(StringPool.BLANK)) {
679 query.append(_FINDER_COLUMN_S_V_VERSION_3);
680 }
681 else {
682 bindVersion = true;
683
684 query.append(_FINDER_COLUMN_S_V_VERSION_2);
685 }
686
687 String sql = query.toString();
688
689 Session session = null;
690
691 try {
692 session = openSession();
693
694 Query q = session.createQuery(sql);
695
696 QueryPos qPos = QueryPos.getInstance(q);
697
698 qPos.add(structureId);
699
700 if (bindVersion) {
701 qPos.add(version);
702 }
703
704 List<DDMStructureVersion> list = q.list();
705
706 if (list.isEmpty()) {
707 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_S_V,
708 finderArgs, list);
709 }
710 else {
711 DDMStructureVersion ddmStructureVersion = list.get(0);
712
713 result = ddmStructureVersion;
714
715 cacheResult(ddmStructureVersion);
716
717 if ((ddmStructureVersion.getStructureId() != structureId) ||
718 (ddmStructureVersion.getVersion() == null) ||
719 !ddmStructureVersion.getVersion().equals(version)) {
720 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_S_V,
721 finderArgs, ddmStructureVersion);
722 }
723 }
724 }
725 catch (Exception e) {
726 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_S_V,
727 finderArgs);
728
729 throw processException(e);
730 }
731 finally {
732 closeSession(session);
733 }
734 }
735
736 if (result instanceof List<?>) {
737 return null;
738 }
739 else {
740 return (DDMStructureVersion)result;
741 }
742 }
743
744
751 @Override
752 public DDMStructureVersion removeByS_V(long structureId, String version)
753 throws NoSuchStructureVersionException {
754 DDMStructureVersion ddmStructureVersion = findByS_V(structureId, version);
755
756 return remove(ddmStructureVersion);
757 }
758
759
766 @Override
767 public int countByS_V(long structureId, String version) {
768 FinderPath finderPath = FINDER_PATH_COUNT_BY_S_V;
769
770 Object[] finderArgs = new Object[] { structureId, version };
771
772 Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
773 this);
774
775 if (count == null) {
776 StringBundler query = new StringBundler(3);
777
778 query.append(_SQL_COUNT_DDMSTRUCTUREVERSION_WHERE);
779
780 query.append(_FINDER_COLUMN_S_V_STRUCTUREID_2);
781
782 boolean bindVersion = false;
783
784 if (version == null) {
785 query.append(_FINDER_COLUMN_S_V_VERSION_1);
786 }
787 else if (version.equals(StringPool.BLANK)) {
788 query.append(_FINDER_COLUMN_S_V_VERSION_3);
789 }
790 else {
791 bindVersion = true;
792
793 query.append(_FINDER_COLUMN_S_V_VERSION_2);
794 }
795
796 String sql = query.toString();
797
798 Session session = null;
799
800 try {
801 session = openSession();
802
803 Query q = session.createQuery(sql);
804
805 QueryPos qPos = QueryPos.getInstance(q);
806
807 qPos.add(structureId);
808
809 if (bindVersion) {
810 qPos.add(version);
811 }
812
813 count = (Long)q.uniqueResult();
814
815 FinderCacheUtil.putResult(finderPath, finderArgs, count);
816 }
817 catch (Exception e) {
818 FinderCacheUtil.removeResult(finderPath, finderArgs);
819
820 throw processException(e);
821 }
822 finally {
823 closeSession(session);
824 }
825 }
826
827 return count.intValue();
828 }
829
830 private static final String _FINDER_COLUMN_S_V_STRUCTUREID_2 = "ddmStructureVersion.structureId = ? AND ";
831 private static final String _FINDER_COLUMN_S_V_VERSION_1 = "ddmStructureVersion.version IS NULL";
832 private static final String _FINDER_COLUMN_S_V_VERSION_2 = "ddmStructureVersion.version = ?";
833 private static final String _FINDER_COLUMN_S_V_VERSION_3 = "(ddmStructureVersion.version IS NULL OR ddmStructureVersion.version = '')";
834
835 public DDMStructureVersionPersistenceImpl() {
836 setModelClass(DDMStructureVersion.class);
837 }
838
839
844 @Override
845 public void cacheResult(DDMStructureVersion ddmStructureVersion) {
846 EntityCacheUtil.putResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
847 DDMStructureVersionImpl.class, ddmStructureVersion.getPrimaryKey(),
848 ddmStructureVersion);
849
850 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_S_V,
851 new Object[] {
852 ddmStructureVersion.getStructureId(),
853 ddmStructureVersion.getVersion()
854 }, ddmStructureVersion);
855
856 ddmStructureVersion.resetOriginalValues();
857 }
858
859
864 @Override
865 public void cacheResult(List<DDMStructureVersion> ddmStructureVersions) {
866 for (DDMStructureVersion ddmStructureVersion : ddmStructureVersions) {
867 if (EntityCacheUtil.getResult(
868 DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
869 DDMStructureVersionImpl.class,
870 ddmStructureVersion.getPrimaryKey()) == null) {
871 cacheResult(ddmStructureVersion);
872 }
873 else {
874 ddmStructureVersion.resetOriginalValues();
875 }
876 }
877 }
878
879
886 @Override
887 public void clearCache() {
888 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
889 CacheRegistryUtil.clear(DDMStructureVersionImpl.class.getName());
890 }
891
892 EntityCacheUtil.clearCache(DDMStructureVersionImpl.class);
893
894 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
895 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
896 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
897 }
898
899
906 @Override
907 public void clearCache(DDMStructureVersion ddmStructureVersion) {
908 EntityCacheUtil.removeResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
909 DDMStructureVersionImpl.class, ddmStructureVersion.getPrimaryKey());
910
911 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
912 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
913
914 clearUniqueFindersCache(ddmStructureVersion);
915 }
916
917 @Override
918 public void clearCache(List<DDMStructureVersion> ddmStructureVersions) {
919 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
920 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
921
922 for (DDMStructureVersion ddmStructureVersion : ddmStructureVersions) {
923 EntityCacheUtil.removeResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
924 DDMStructureVersionImpl.class,
925 ddmStructureVersion.getPrimaryKey());
926
927 clearUniqueFindersCache(ddmStructureVersion);
928 }
929 }
930
931 protected void cacheUniqueFindersCache(
932 DDMStructureVersion ddmStructureVersion) {
933 if (ddmStructureVersion.isNew()) {
934 Object[] args = new Object[] {
935 ddmStructureVersion.getStructureId(),
936 ddmStructureVersion.getVersion()
937 };
938
939 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_S_V, args,
940 Long.valueOf(1));
941 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_S_V, args,
942 ddmStructureVersion);
943 }
944 else {
945 DDMStructureVersionModelImpl ddmStructureVersionModelImpl = (DDMStructureVersionModelImpl)ddmStructureVersion;
946
947 if ((ddmStructureVersionModelImpl.getColumnBitmask() &
948 FINDER_PATH_FETCH_BY_S_V.getColumnBitmask()) != 0) {
949 Object[] args = new Object[] {
950 ddmStructureVersion.getStructureId(),
951 ddmStructureVersion.getVersion()
952 };
953
954 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_S_V, args,
955 Long.valueOf(1));
956 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_S_V, args,
957 ddmStructureVersion);
958 }
959 }
960 }
961
962 protected void clearUniqueFindersCache(
963 DDMStructureVersion ddmStructureVersion) {
964 DDMStructureVersionModelImpl ddmStructureVersionModelImpl = (DDMStructureVersionModelImpl)ddmStructureVersion;
965
966 Object[] args = new Object[] {
967 ddmStructureVersion.getStructureId(),
968 ddmStructureVersion.getVersion()
969 };
970
971 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_S_V, args);
972 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_S_V, args);
973
974 if ((ddmStructureVersionModelImpl.getColumnBitmask() &
975 FINDER_PATH_FETCH_BY_S_V.getColumnBitmask()) != 0) {
976 args = new Object[] {
977 ddmStructureVersionModelImpl.getOriginalStructureId(),
978 ddmStructureVersionModelImpl.getOriginalVersion()
979 };
980
981 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_S_V, args);
982 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_S_V, args);
983 }
984 }
985
986
992 @Override
993 public DDMStructureVersion create(long structureVersionId) {
994 DDMStructureVersion ddmStructureVersion = new DDMStructureVersionImpl();
995
996 ddmStructureVersion.setNew(true);
997 ddmStructureVersion.setPrimaryKey(structureVersionId);
998
999 return ddmStructureVersion;
1000 }
1001
1002
1009 @Override
1010 public DDMStructureVersion remove(long structureVersionId)
1011 throws NoSuchStructureVersionException {
1012 return remove((Serializable)structureVersionId);
1013 }
1014
1015
1022 @Override
1023 public DDMStructureVersion remove(Serializable primaryKey)
1024 throws NoSuchStructureVersionException {
1025 Session session = null;
1026
1027 try {
1028 session = openSession();
1029
1030 DDMStructureVersion ddmStructureVersion = (DDMStructureVersion)session.get(DDMStructureVersionImpl.class,
1031 primaryKey);
1032
1033 if (ddmStructureVersion == null) {
1034 if (_log.isWarnEnabled()) {
1035 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1036 }
1037
1038 throw new NoSuchStructureVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1039 primaryKey);
1040 }
1041
1042 return remove(ddmStructureVersion);
1043 }
1044 catch (NoSuchStructureVersionException nsee) {
1045 throw nsee;
1046 }
1047 catch (Exception e) {
1048 throw processException(e);
1049 }
1050 finally {
1051 closeSession(session);
1052 }
1053 }
1054
1055 @Override
1056 protected DDMStructureVersion removeImpl(
1057 DDMStructureVersion ddmStructureVersion) {
1058 ddmStructureVersion = toUnwrappedModel(ddmStructureVersion);
1059
1060 Session session = null;
1061
1062 try {
1063 session = openSession();
1064
1065 if (!session.contains(ddmStructureVersion)) {
1066 ddmStructureVersion = (DDMStructureVersion)session.get(DDMStructureVersionImpl.class,
1067 ddmStructureVersion.getPrimaryKeyObj());
1068 }
1069
1070 if (ddmStructureVersion != null) {
1071 session.delete(ddmStructureVersion);
1072 }
1073 }
1074 catch (Exception e) {
1075 throw processException(e);
1076 }
1077 finally {
1078 closeSession(session);
1079 }
1080
1081 if (ddmStructureVersion != null) {
1082 clearCache(ddmStructureVersion);
1083 }
1084
1085 return ddmStructureVersion;
1086 }
1087
1088 @Override
1089 public DDMStructureVersion updateImpl(
1090 com.liferay.portlet.dynamicdatamapping.model.DDMStructureVersion ddmStructureVersion) {
1091 ddmStructureVersion = toUnwrappedModel(ddmStructureVersion);
1092
1093 boolean isNew = ddmStructureVersion.isNew();
1094
1095 DDMStructureVersionModelImpl ddmStructureVersionModelImpl = (DDMStructureVersionModelImpl)ddmStructureVersion;
1096
1097 Session session = null;
1098
1099 try {
1100 session = openSession();
1101
1102 if (ddmStructureVersion.isNew()) {
1103 session.save(ddmStructureVersion);
1104
1105 ddmStructureVersion.setNew(false);
1106 }
1107 else {
1108 session.merge(ddmStructureVersion);
1109 }
1110 }
1111 catch (Exception e) {
1112 throw processException(e);
1113 }
1114 finally {
1115 closeSession(session);
1116 }
1117
1118 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1119
1120 if (isNew || !DDMStructureVersionModelImpl.COLUMN_BITMASK_ENABLED) {
1121 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1122 }
1123
1124 else {
1125 if ((ddmStructureVersionModelImpl.getColumnBitmask() &
1126 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID.getColumnBitmask()) != 0) {
1127 Object[] args = new Object[] {
1128 ddmStructureVersionModelImpl.getOriginalStructureId()
1129 };
1130
1131 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1132 args);
1133 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
1134 args);
1135
1136 args = new Object[] {
1137 ddmStructureVersionModelImpl.getStructureId()
1138 };
1139
1140 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_STRUCTUREID,
1141 args);
1142 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_STRUCTUREID,
1143 args);
1144 }
1145 }
1146
1147 EntityCacheUtil.putResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1148 DDMStructureVersionImpl.class, ddmStructureVersion.getPrimaryKey(),
1149 ddmStructureVersion, false);
1150
1151 clearUniqueFindersCache(ddmStructureVersion);
1152 cacheUniqueFindersCache(ddmStructureVersion);
1153
1154 ddmStructureVersion.resetOriginalValues();
1155
1156 return ddmStructureVersion;
1157 }
1158
1159 protected DDMStructureVersion toUnwrappedModel(
1160 DDMStructureVersion ddmStructureVersion) {
1161 if (ddmStructureVersion instanceof DDMStructureVersionImpl) {
1162 return ddmStructureVersion;
1163 }
1164
1165 DDMStructureVersionImpl ddmStructureVersionImpl = new DDMStructureVersionImpl();
1166
1167 ddmStructureVersionImpl.setNew(ddmStructureVersion.isNew());
1168 ddmStructureVersionImpl.setPrimaryKey(ddmStructureVersion.getPrimaryKey());
1169
1170 ddmStructureVersionImpl.setStructureVersionId(ddmStructureVersion.getStructureVersionId());
1171 ddmStructureVersionImpl.setGroupId(ddmStructureVersion.getGroupId());
1172 ddmStructureVersionImpl.setCompanyId(ddmStructureVersion.getCompanyId());
1173 ddmStructureVersionImpl.setUserId(ddmStructureVersion.getUserId());
1174 ddmStructureVersionImpl.setUserName(ddmStructureVersion.getUserName());
1175 ddmStructureVersionImpl.setCreateDate(ddmStructureVersion.getCreateDate());
1176 ddmStructureVersionImpl.setStructureId(ddmStructureVersion.getStructureId());
1177 ddmStructureVersionImpl.setVersion(ddmStructureVersion.getVersion());
1178 ddmStructureVersionImpl.setName(ddmStructureVersion.getName());
1179 ddmStructureVersionImpl.setDescription(ddmStructureVersion.getDescription());
1180 ddmStructureVersionImpl.setDefinition(ddmStructureVersion.getDefinition());
1181 ddmStructureVersionImpl.setStorageType(ddmStructureVersion.getStorageType());
1182 ddmStructureVersionImpl.setType(ddmStructureVersion.getType());
1183
1184 return ddmStructureVersionImpl;
1185 }
1186
1187
1194 @Override
1195 public DDMStructureVersion findByPrimaryKey(Serializable primaryKey)
1196 throws NoSuchStructureVersionException {
1197 DDMStructureVersion ddmStructureVersion = fetchByPrimaryKey(primaryKey);
1198
1199 if (ddmStructureVersion == null) {
1200 if (_log.isWarnEnabled()) {
1201 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1202 }
1203
1204 throw new NoSuchStructureVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1205 primaryKey);
1206 }
1207
1208 return ddmStructureVersion;
1209 }
1210
1211
1218 @Override
1219 public DDMStructureVersion findByPrimaryKey(long structureVersionId)
1220 throws NoSuchStructureVersionException {
1221 return findByPrimaryKey((Serializable)structureVersionId);
1222 }
1223
1224
1230 @Override
1231 public DDMStructureVersion fetchByPrimaryKey(Serializable primaryKey) {
1232 DDMStructureVersion ddmStructureVersion = (DDMStructureVersion)EntityCacheUtil.getResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1233 DDMStructureVersionImpl.class, primaryKey);
1234
1235 if (ddmStructureVersion == _nullDDMStructureVersion) {
1236 return null;
1237 }
1238
1239 if (ddmStructureVersion == null) {
1240 Session session = null;
1241
1242 try {
1243 session = openSession();
1244
1245 ddmStructureVersion = (DDMStructureVersion)session.get(DDMStructureVersionImpl.class,
1246 primaryKey);
1247
1248 if (ddmStructureVersion != null) {
1249 cacheResult(ddmStructureVersion);
1250 }
1251 else {
1252 EntityCacheUtil.putResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1253 DDMStructureVersionImpl.class, primaryKey,
1254 _nullDDMStructureVersion);
1255 }
1256 }
1257 catch (Exception e) {
1258 EntityCacheUtil.removeResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1259 DDMStructureVersionImpl.class, primaryKey);
1260
1261 throw processException(e);
1262 }
1263 finally {
1264 closeSession(session);
1265 }
1266 }
1267
1268 return ddmStructureVersion;
1269 }
1270
1271
1277 @Override
1278 public DDMStructureVersion fetchByPrimaryKey(long structureVersionId) {
1279 return fetchByPrimaryKey((Serializable)structureVersionId);
1280 }
1281
1282 @Override
1283 public Map<Serializable, DDMStructureVersion> fetchByPrimaryKeys(
1284 Set<Serializable> primaryKeys) {
1285 if (primaryKeys.isEmpty()) {
1286 return Collections.emptyMap();
1287 }
1288
1289 Map<Serializable, DDMStructureVersion> map = new HashMap<Serializable, DDMStructureVersion>();
1290
1291 if (primaryKeys.size() == 1) {
1292 Iterator<Serializable> iterator = primaryKeys.iterator();
1293
1294 Serializable primaryKey = iterator.next();
1295
1296 DDMStructureVersion ddmStructureVersion = fetchByPrimaryKey(primaryKey);
1297
1298 if (ddmStructureVersion != null) {
1299 map.put(primaryKey, ddmStructureVersion);
1300 }
1301
1302 return map;
1303 }
1304
1305 Set<Serializable> uncachedPrimaryKeys = null;
1306
1307 for (Serializable primaryKey : primaryKeys) {
1308 DDMStructureVersion ddmStructureVersion = (DDMStructureVersion)EntityCacheUtil.getResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1309 DDMStructureVersionImpl.class, primaryKey);
1310
1311 if (ddmStructureVersion == null) {
1312 if (uncachedPrimaryKeys == null) {
1313 uncachedPrimaryKeys = new HashSet<Serializable>();
1314 }
1315
1316 uncachedPrimaryKeys.add(primaryKey);
1317 }
1318 else {
1319 map.put(primaryKey, ddmStructureVersion);
1320 }
1321 }
1322
1323 if (uncachedPrimaryKeys == null) {
1324 return map;
1325 }
1326
1327 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
1328 1);
1329
1330 query.append(_SQL_SELECT_DDMSTRUCTUREVERSION_WHERE_PKS_IN);
1331
1332 for (Serializable primaryKey : uncachedPrimaryKeys) {
1333 query.append(String.valueOf(primaryKey));
1334
1335 query.append(StringPool.COMMA);
1336 }
1337
1338 query.setIndex(query.index() - 1);
1339
1340 query.append(StringPool.CLOSE_PARENTHESIS);
1341
1342 String sql = query.toString();
1343
1344 Session session = null;
1345
1346 try {
1347 session = openSession();
1348
1349 Query q = session.createQuery(sql);
1350
1351 for (DDMStructureVersion ddmStructureVersion : (List<DDMStructureVersion>)q.list()) {
1352 map.put(ddmStructureVersion.getPrimaryKeyObj(),
1353 ddmStructureVersion);
1354
1355 cacheResult(ddmStructureVersion);
1356
1357 uncachedPrimaryKeys.remove(ddmStructureVersion.getPrimaryKeyObj());
1358 }
1359
1360 for (Serializable primaryKey : uncachedPrimaryKeys) {
1361 EntityCacheUtil.putResult(DDMStructureVersionModelImpl.ENTITY_CACHE_ENABLED,
1362 DDMStructureVersionImpl.class, primaryKey,
1363 _nullDDMStructureVersion);
1364 }
1365 }
1366 catch (Exception e) {
1367 throw processException(e);
1368 }
1369 finally {
1370 closeSession(session);
1371 }
1372
1373 return map;
1374 }
1375
1376
1381 @Override
1382 public List<DDMStructureVersion> findAll() {
1383 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1384 }
1385
1386
1397 @Override
1398 public List<DDMStructureVersion> findAll(int start, int end) {
1399 return findAll(start, end, null);
1400 }
1401
1402
1414 @Override
1415 public List<DDMStructureVersion> findAll(int start, int end,
1416 OrderByComparator<DDMStructureVersion> orderByComparator) {
1417 boolean pagination = true;
1418 FinderPath finderPath = null;
1419 Object[] finderArgs = null;
1420
1421 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1422 (orderByComparator == null)) {
1423 pagination = false;
1424 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1425 finderArgs = FINDER_ARGS_EMPTY;
1426 }
1427 else {
1428 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1429 finderArgs = new Object[] { start, end, orderByComparator };
1430 }
1431
1432 List<DDMStructureVersion> list = (List<DDMStructureVersion>)FinderCacheUtil.getResult(finderPath,
1433 finderArgs, this);
1434
1435 if (list == null) {
1436 StringBundler query = null;
1437 String sql = null;
1438
1439 if (orderByComparator != null) {
1440 query = new StringBundler(2 +
1441 (orderByComparator.getOrderByFields().length * 3));
1442
1443 query.append(_SQL_SELECT_DDMSTRUCTUREVERSION);
1444
1445 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1446 orderByComparator);
1447
1448 sql = query.toString();
1449 }
1450 else {
1451 sql = _SQL_SELECT_DDMSTRUCTUREVERSION;
1452
1453 if (pagination) {
1454 sql = sql.concat(DDMStructureVersionModelImpl.ORDER_BY_JPQL);
1455 }
1456 }
1457
1458 Session session = null;
1459
1460 try {
1461 session = openSession();
1462
1463 Query q = session.createQuery(sql);
1464
1465 if (!pagination) {
1466 list = (List<DDMStructureVersion>)QueryUtil.list(q,
1467 getDialect(), start, end, false);
1468
1469 Collections.sort(list);
1470
1471 list = Collections.unmodifiableList(list);
1472 }
1473 else {
1474 list = (List<DDMStructureVersion>)QueryUtil.list(q,
1475 getDialect(), start, end);
1476 }
1477
1478 cacheResult(list);
1479
1480 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1481 }
1482 catch (Exception e) {
1483 FinderCacheUtil.removeResult(finderPath, finderArgs);
1484
1485 throw processException(e);
1486 }
1487 finally {
1488 closeSession(session);
1489 }
1490 }
1491
1492 return list;
1493 }
1494
1495
1499 @Override
1500 public void removeAll() {
1501 for (DDMStructureVersion ddmStructureVersion : findAll()) {
1502 remove(ddmStructureVersion);
1503 }
1504 }
1505
1506
1511 @Override
1512 public int countAll() {
1513 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1514 FINDER_ARGS_EMPTY, this);
1515
1516 if (count == null) {
1517 Session session = null;
1518
1519 try {
1520 session = openSession();
1521
1522 Query q = session.createQuery(_SQL_COUNT_DDMSTRUCTUREVERSION);
1523
1524 count = (Long)q.uniqueResult();
1525
1526 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1527 FINDER_ARGS_EMPTY, count);
1528 }
1529 catch (Exception e) {
1530 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1531 FINDER_ARGS_EMPTY);
1532
1533 throw processException(e);
1534 }
1535 finally {
1536 closeSession(session);
1537 }
1538 }
1539
1540 return count.intValue();
1541 }
1542
1543 @Override
1544 protected Set<String> getBadColumnNames() {
1545 return _badColumnNames;
1546 }
1547
1548
1551 public void afterPropertiesSet() {
1552 }
1553
1554 public void destroy() {
1555 EntityCacheUtil.removeCache(DDMStructureVersionImpl.class.getName());
1556 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1557 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1558 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1559 }
1560
1561 private static final String _SQL_SELECT_DDMSTRUCTUREVERSION = "SELECT ddmStructureVersion FROM DDMStructureVersion ddmStructureVersion";
1562 private static final String _SQL_SELECT_DDMSTRUCTUREVERSION_WHERE_PKS_IN = "SELECT ddmStructureVersion FROM DDMStructureVersion ddmStructureVersion WHERE structureVersionId IN (";
1563 private static final String _SQL_SELECT_DDMSTRUCTUREVERSION_WHERE = "SELECT ddmStructureVersion FROM DDMStructureVersion ddmStructureVersion WHERE ";
1564 private static final String _SQL_COUNT_DDMSTRUCTUREVERSION = "SELECT COUNT(ddmStructureVersion) FROM DDMStructureVersion ddmStructureVersion";
1565 private static final String _SQL_COUNT_DDMSTRUCTUREVERSION_WHERE = "SELECT COUNT(ddmStructureVersion) FROM DDMStructureVersion ddmStructureVersion WHERE ";
1566 private static final String _ORDER_BY_ENTITY_ALIAS = "ddmStructureVersion.";
1567 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DDMStructureVersion exists with the primary key ";
1568 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DDMStructureVersion exists with the key {";
1569 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1570 private static final Log _log = LogFactoryUtil.getLog(DDMStructureVersionPersistenceImpl.class);
1571 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1572 "type"
1573 });
1574 private static final DDMStructureVersion _nullDDMStructureVersion = new DDMStructureVersionImpl() {
1575 @Override
1576 public Object clone() {
1577 return this;
1578 }
1579
1580 @Override
1581 public CacheModel<DDMStructureVersion> toCacheModel() {
1582 return _nullDDMStructureVersionCacheModel;
1583 }
1584 };
1585
1586 private static final CacheModel<DDMStructureVersion> _nullDDMStructureVersionCacheModel =
1587 new CacheModel<DDMStructureVersion>() {
1588 @Override
1589 public DDMStructureVersion toEntityModel() {
1590 return _nullDDMStructureVersion;
1591 }
1592 };
1593 }