1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchImageException;
18  import com.liferay.portal.NoSuchModelException;
19  import com.liferay.portal.SystemException;
20  import com.liferay.portal.kernel.annotation.BeanReference;
21  import com.liferay.portal.kernel.cache.CacheRegistry;
22  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
24  import com.liferay.portal.kernel.dao.orm.FinderPath;
25  import com.liferay.portal.kernel.dao.orm.Query;
26  import com.liferay.portal.kernel.dao.orm.QueryPos;
27  import com.liferay.portal.kernel.dao.orm.QueryUtil;
28  import com.liferay.portal.kernel.dao.orm.Session;
29  import com.liferay.portal.kernel.log.Log;
30  import com.liferay.portal.kernel.log.LogFactoryUtil;
31  import com.liferay.portal.kernel.util.GetterUtil;
32  import com.liferay.portal.kernel.util.InstanceFactory;
33  import com.liferay.portal.kernel.util.OrderByComparator;
34  import com.liferay.portal.kernel.util.StringBundler;
35  import com.liferay.portal.kernel.util.StringPool;
36  import com.liferay.portal.kernel.util.StringUtil;
37  import com.liferay.portal.model.Image;
38  import com.liferay.portal.model.ModelListener;
39  import com.liferay.portal.model.impl.ImageImpl;
40  import com.liferay.portal.model.impl.ImageModelImpl;
41  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
42  
43  import com.liferay.portlet.imagegallery.service.persistence.IGImagePersistence;
44  
45  import java.io.Serializable;
46  
47  import java.util.ArrayList;
48  import java.util.Collections;
49  import java.util.List;
50  
51  /**
52   * <a href="ImagePersistenceImpl.java.html"><b><i>View Source</i></b></a>
53   *
54   * <p>
55   * ServiceBuilder generated this class. Modifications in this class will be
56   * overwritten the next time is generated.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       ImagePersistence
61   * @see       ImageUtil
62   * @generated
63   */
64  public class ImagePersistenceImpl extends BasePersistenceImpl<Image>
65      implements ImagePersistence {
66      public static final String FINDER_CLASS_NAME_ENTITY = ImageImpl.class.getName();
67      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
68          ".List";
69      public static final FinderPath FINDER_PATH_FIND_BY_SIZE = new FinderPath(ImageModelImpl.ENTITY_CACHE_ENABLED,
70              ImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
71              "findBySize",
72              new String[] {
73                  Integer.class.getName(),
74                  
75              "java.lang.Integer", "java.lang.Integer",
76                  "com.liferay.portal.kernel.util.OrderByComparator"
77              });
78      public static final FinderPath FINDER_PATH_COUNT_BY_SIZE = new FinderPath(ImageModelImpl.ENTITY_CACHE_ENABLED,
79              ImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
80              "countBySize", new String[] { Integer.class.getName() });
81      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ImageModelImpl.ENTITY_CACHE_ENABLED,
82              ImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
83              "findAll", new String[0]);
84      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ImageModelImpl.ENTITY_CACHE_ENABLED,
85              ImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
86              "countAll", new String[0]);
87  
88      public void cacheResult(Image image) {
89          EntityCacheUtil.putResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
90              ImageImpl.class, image.getPrimaryKey(), image);
91      }
92  
93      public void cacheResult(List<Image> images) {
94          for (Image image : images) {
95              if (EntityCacheUtil.getResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
96                          ImageImpl.class, image.getPrimaryKey(), this) == null) {
97                  cacheResult(image);
98              }
99          }
100     }
101 
102     public void clearCache() {
103         CacheRegistry.clear(ImageImpl.class.getName());
104         EntityCacheUtil.clearCache(ImageImpl.class.getName());
105         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
106         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
107     }
108 
109     public void clearCache(Image image) {
110         EntityCacheUtil.removeResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
111             ImageImpl.class, image.getPrimaryKey());
112     }
113 
114     public Image create(long imageId) {
115         Image image = new ImageImpl();
116 
117         image.setNew(true);
118         image.setPrimaryKey(imageId);
119 
120         return image;
121     }
122 
123     public Image remove(Serializable primaryKey)
124         throws NoSuchModelException, SystemException {
125         return remove(((Long)primaryKey).longValue());
126     }
127 
128     public Image remove(long imageId)
129         throws NoSuchImageException, SystemException {
130         Session session = null;
131 
132         try {
133             session = openSession();
134 
135             Image image = (Image)session.get(ImageImpl.class, new Long(imageId));
136 
137             if (image == null) {
138                 if (_log.isWarnEnabled()) {
139                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + imageId);
140                 }
141 
142                 throw new NoSuchImageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
143                     imageId);
144             }
145 
146             return remove(image);
147         }
148         catch (NoSuchImageException nsee) {
149             throw nsee;
150         }
151         catch (Exception e) {
152             throw processException(e);
153         }
154         finally {
155             closeSession(session);
156         }
157     }
158 
159     protected Image removeImpl(Image image) throws SystemException {
160         image = toUnwrappedModel(image);
161 
162         Session session = null;
163 
164         try {
165             session = openSession();
166 
167             BatchSessionUtil.delete(session, image);
168         }
169         catch (Exception e) {
170             throw processException(e);
171         }
172         finally {
173             closeSession(session);
174         }
175 
176         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
177 
178         EntityCacheUtil.removeResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
179             ImageImpl.class, image.getPrimaryKey());
180 
181         return image;
182     }
183 
184     /**
185      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
186      */
187     public Image update(Image image) throws SystemException {
188         if (_log.isWarnEnabled()) {
189             _log.warn(
190                 "Using the deprecated update(Image image) method. Use update(Image image, boolean merge) instead.");
191         }
192 
193         return update(image, false);
194     }
195 
196     public Image updateImpl(com.liferay.portal.model.Image image, boolean merge)
197         throws SystemException {
198         image = toUnwrappedModel(image);
199 
200         Session session = null;
201 
202         try {
203             session = openSession();
204 
205             BatchSessionUtil.update(session, image, merge);
206 
207             image.setNew(false);
208         }
209         catch (Exception e) {
210             throw processException(e);
211         }
212         finally {
213             closeSession(session);
214         }
215 
216         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
217 
218         EntityCacheUtil.putResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
219             ImageImpl.class, image.getPrimaryKey(), image);
220 
221         return image;
222     }
223 
224     protected Image toUnwrappedModel(Image image) {
225         if (image instanceof ImageImpl) {
226             return image;
227         }
228 
229         ImageImpl imageImpl = new ImageImpl();
230 
231         imageImpl.setNew(image.isNew());
232         imageImpl.setPrimaryKey(image.getPrimaryKey());
233 
234         imageImpl.setImageId(image.getImageId());
235         imageImpl.setModifiedDate(image.getModifiedDate());
236         imageImpl.setText(image.getText());
237         imageImpl.setType(image.getType());
238         imageImpl.setHeight(image.getHeight());
239         imageImpl.setWidth(image.getWidth());
240         imageImpl.setSize(image.getSize());
241 
242         return imageImpl;
243     }
244 
245     public Image findByPrimaryKey(Serializable primaryKey)
246         throws NoSuchModelException, SystemException {
247         return findByPrimaryKey(((Long)primaryKey).longValue());
248     }
249 
250     public Image findByPrimaryKey(long imageId)
251         throws NoSuchImageException, SystemException {
252         Image image = fetchByPrimaryKey(imageId);
253 
254         if (image == null) {
255             if (_log.isWarnEnabled()) {
256                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + imageId);
257             }
258 
259             throw new NoSuchImageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
260                 imageId);
261         }
262 
263         return image;
264     }
265 
266     public Image fetchByPrimaryKey(Serializable primaryKey)
267         throws SystemException {
268         return fetchByPrimaryKey(((Long)primaryKey).longValue());
269     }
270 
271     public Image fetchByPrimaryKey(long imageId) throws SystemException {
272         Image image = (Image)EntityCacheUtil.getResult(ImageModelImpl.ENTITY_CACHE_ENABLED,
273                 ImageImpl.class, imageId, this);
274 
275         if (image == null) {
276             Session session = null;
277 
278             try {
279                 session = openSession();
280 
281                 image = (Image)session.get(ImageImpl.class, new Long(imageId));
282             }
283             catch (Exception e) {
284                 throw processException(e);
285             }
286             finally {
287                 if (image != null) {
288                     cacheResult(image);
289                 }
290 
291                 closeSession(session);
292             }
293         }
294 
295         return image;
296     }
297 
298     public List<Image> findBySize(int size) throws SystemException {
299         return findBySize(size, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
300     }
301 
302     public List<Image> findBySize(int size, int start, int end)
303         throws SystemException {
304         return findBySize(size, start, end, null);
305     }
306 
307     public List<Image> findBySize(int size, int start, int end,
308         OrderByComparator orderByComparator) throws SystemException {
309         Object[] finderArgs = new Object[] {
310                 size,
311                 
312                 String.valueOf(start), String.valueOf(end),
313                 String.valueOf(orderByComparator)
314             };
315 
316         List<Image> list = (List<Image>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SIZE,
317                 finderArgs, this);
318 
319         if (list == null) {
320             StringBundler query = null;
321 
322             if (orderByComparator != null) {
323                 query = new StringBundler(3 +
324                         (orderByComparator.getOrderByFields().length * 3));
325             }
326             else {
327                 query = new StringBundler(3);
328             }
329 
330             query.append(_SQL_SELECT_IMAGE_WHERE);
331 
332             query.append(_FINDER_COLUMN_SIZE_SIZE_2);
333 
334             if (orderByComparator != null) {
335                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
336                     orderByComparator);
337             }
338 
339             else {
340                 query.append(ImageModelImpl.ORDER_BY_JPQL);
341             }
342 
343             String sql = query.toString();
344 
345             Session session = null;
346 
347             try {
348                 session = openSession();
349 
350                 Query q = session.createQuery(sql);
351 
352                 QueryPos qPos = QueryPos.getInstance(q);
353 
354                 qPos.add(size);
355 
356                 list = (List<Image>)QueryUtil.list(q, getDialect(), start, end);
357             }
358             catch (Exception e) {
359                 throw processException(e);
360             }
361             finally {
362                 if (list == null) {
363                     list = new ArrayList<Image>();
364                 }
365 
366                 cacheResult(list);
367 
368                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SIZE, finderArgs,
369                     list);
370 
371                 closeSession(session);
372             }
373         }
374 
375         return list;
376     }
377 
378     public Image findBySize_First(int size, OrderByComparator orderByComparator)
379         throws NoSuchImageException, SystemException {
380         List<Image> list = findBySize(size, 0, 1, orderByComparator);
381 
382         if (list.isEmpty()) {
383             StringBundler msg = new StringBundler(4);
384 
385             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
386 
387             msg.append("size=");
388             msg.append(size);
389 
390             msg.append(StringPool.CLOSE_CURLY_BRACE);
391 
392             throw new NoSuchImageException(msg.toString());
393         }
394         else {
395             return list.get(0);
396         }
397     }
398 
399     public Image findBySize_Last(int size, OrderByComparator orderByComparator)
400         throws NoSuchImageException, SystemException {
401         int count = countBySize(size);
402 
403         List<Image> list = findBySize(size, count - 1, count, orderByComparator);
404 
405         if (list.isEmpty()) {
406             StringBundler msg = new StringBundler(4);
407 
408             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
409 
410             msg.append("size=");
411             msg.append(size);
412 
413             msg.append(StringPool.CLOSE_CURLY_BRACE);
414 
415             throw new NoSuchImageException(msg.toString());
416         }
417         else {
418             return list.get(0);
419         }
420     }
421 
422     public Image[] findBySize_PrevAndNext(long imageId, int size,
423         OrderByComparator orderByComparator)
424         throws NoSuchImageException, SystemException {
425         Image image = findByPrimaryKey(imageId);
426 
427         Session session = null;
428 
429         try {
430             session = openSession();
431 
432             Image[] array = new ImageImpl[3];
433 
434             array[0] = getBySize_PrevAndNext(session, image, size,
435                     orderByComparator, true);
436 
437             array[1] = image;
438 
439             array[2] = getBySize_PrevAndNext(session, image, size,
440                     orderByComparator, false);
441 
442             return array;
443         }
444         catch (Exception e) {
445             throw processException(e);
446         }
447         finally {
448             closeSession(session);
449         }
450     }
451 
452     protected Image getBySize_PrevAndNext(Session session, Image image,
453         int size, OrderByComparator orderByComparator, boolean previous) {
454         StringBundler query = null;
455 
456         if (orderByComparator != null) {
457             query = new StringBundler(6 +
458                     (orderByComparator.getOrderByFields().length * 6));
459         }
460         else {
461             query = new StringBundler(3);
462         }
463 
464         query.append(_SQL_SELECT_IMAGE_WHERE);
465 
466         query.append(_FINDER_COLUMN_SIZE_SIZE_2);
467 
468         if (orderByComparator != null) {
469             String[] orderByFields = orderByComparator.getOrderByFields();
470 
471             if (orderByFields.length > 0) {
472                 query.append(WHERE_AND);
473             }
474 
475             for (int i = 0; i < orderByFields.length; i++) {
476                 query.append(_ORDER_BY_ENTITY_ALIAS);
477                 query.append(orderByFields[i]);
478 
479                 if ((i + 1) < orderByFields.length) {
480                     if (orderByComparator.isAscending() ^ previous) {
481                         query.append(WHERE_GREATER_THAN_HAS_NEXT);
482                     }
483                     else {
484                         query.append(WHERE_LESSER_THAN_HAS_NEXT);
485                     }
486                 }
487                 else {
488                     if (orderByComparator.isAscending() ^ previous) {
489                         query.append(WHERE_GREATER_THAN);
490                     }
491                     else {
492                         query.append(WHERE_LESSER_THAN);
493                     }
494                 }
495             }
496 
497             query.append(ORDER_BY_CLAUSE);
498 
499             for (int i = 0; i < orderByFields.length; i++) {
500                 query.append(_ORDER_BY_ENTITY_ALIAS);
501                 query.append(orderByFields[i]);
502 
503                 if ((i + 1) < orderByFields.length) {
504                     if (orderByComparator.isAscending() ^ previous) {
505                         query.append(ORDER_BY_ASC_HAS_NEXT);
506                     }
507                     else {
508                         query.append(ORDER_BY_DESC_HAS_NEXT);
509                     }
510                 }
511                 else {
512                     if (orderByComparator.isAscending() ^ previous) {
513                         query.append(ORDER_BY_ASC);
514                     }
515                     else {
516                         query.append(ORDER_BY_DESC);
517                     }
518                 }
519             }
520         }
521 
522         else {
523             query.append(ImageModelImpl.ORDER_BY_JPQL);
524         }
525 
526         String sql = query.toString();
527 
528         Query q = session.createQuery(sql);
529 
530         q.setFirstResult(0);
531         q.setMaxResults(2);
532 
533         QueryPos qPos = QueryPos.getInstance(q);
534 
535         qPos.add(size);
536 
537         if (orderByComparator != null) {
538             Object[] values = orderByComparator.getOrderByValues(image);
539 
540             for (Object value : values) {
541                 qPos.add(value);
542             }
543         }
544 
545         List<Image> list = q.list();
546 
547         if (list.size() == 2) {
548             return list.get(1);
549         }
550         else {
551             return null;
552         }
553     }
554 
555     public List<Image> findAll() throws SystemException {
556         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
557     }
558 
559     public List<Image> findAll(int start, int end) throws SystemException {
560         return findAll(start, end, null);
561     }
562 
563     public List<Image> findAll(int start, int end,
564         OrderByComparator orderByComparator) throws SystemException {
565         Object[] finderArgs = new Object[] {
566                 String.valueOf(start), String.valueOf(end),
567                 String.valueOf(orderByComparator)
568             };
569 
570         List<Image> list = (List<Image>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
571                 finderArgs, this);
572 
573         if (list == null) {
574             StringBundler query = null;
575             String sql = null;
576 
577             if (orderByComparator != null) {
578                 query = new StringBundler(2 +
579                         (orderByComparator.getOrderByFields().length * 3));
580 
581                 query.append(_SQL_SELECT_IMAGE);
582 
583                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
584                     orderByComparator);
585 
586                 sql = query.toString();
587             }
588             else {
589                 sql = _SQL_SELECT_IMAGE.concat(ImageModelImpl.ORDER_BY_JPQL);
590             }
591 
592             Session session = null;
593 
594             try {
595                 session = openSession();
596 
597                 Query q = session.createQuery(sql);
598 
599                 if (orderByComparator == null) {
600                     list = (List<Image>)QueryUtil.list(q, getDialect(), start,
601                             end, false);
602 
603                     Collections.sort(list);
604                 }
605                 else {
606                     list = (List<Image>)QueryUtil.list(q, getDialect(), start,
607                             end);
608                 }
609             }
610             catch (Exception e) {
611                 throw processException(e);
612             }
613             finally {
614                 if (list == null) {
615                     list = new ArrayList<Image>();
616                 }
617 
618                 cacheResult(list);
619 
620                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
621 
622                 closeSession(session);
623             }
624         }
625 
626         return list;
627     }
628 
629     public void removeBySize(int size) throws SystemException {
630         for (Image image : findBySize(size)) {
631             remove(image);
632         }
633     }
634 
635     public void removeAll() throws SystemException {
636         for (Image image : findAll()) {
637             remove(image);
638         }
639     }
640 
641     public int countBySize(int size) throws SystemException {
642         Object[] finderArgs = new Object[] { size };
643 
644         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SIZE,
645                 finderArgs, this);
646 
647         if (count == null) {
648             StringBundler query = new StringBundler(2);
649 
650             query.append(_SQL_COUNT_IMAGE_WHERE);
651 
652             query.append(_FINDER_COLUMN_SIZE_SIZE_2);
653 
654             String sql = query.toString();
655 
656             Session session = null;
657 
658             try {
659                 session = openSession();
660 
661                 Query q = session.createQuery(sql);
662 
663                 QueryPos qPos = QueryPos.getInstance(q);
664 
665                 qPos.add(size);
666 
667                 count = (Long)q.uniqueResult();
668             }
669             catch (Exception e) {
670                 throw processException(e);
671             }
672             finally {
673                 if (count == null) {
674                     count = Long.valueOf(0);
675                 }
676 
677                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SIZE,
678                     finderArgs, count);
679 
680                 closeSession(session);
681             }
682         }
683 
684         return count.intValue();
685     }
686 
687     public int countAll() throws SystemException {
688         Object[] finderArgs = new Object[0];
689 
690         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
691                 finderArgs, this);
692 
693         if (count == null) {
694             Session session = null;
695 
696             try {
697                 session = openSession();
698 
699                 Query q = session.createQuery(_SQL_COUNT_IMAGE);
700 
701                 count = (Long)q.uniqueResult();
702             }
703             catch (Exception e) {
704                 throw processException(e);
705             }
706             finally {
707                 if (count == null) {
708                     count = Long.valueOf(0);
709                 }
710 
711                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
712                     count);
713 
714                 closeSession(session);
715             }
716         }
717 
718         return count.intValue();
719     }
720 
721     public void afterPropertiesSet() {
722         String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
723                     com.liferay.portal.util.PropsUtil.get(
724                         "value.object.listener.com.liferay.portal.model.Image")));
725 
726         if (listenerClassNames.length > 0) {
727             try {
728                 List<ModelListener<Image>> listenersList = new ArrayList<ModelListener<Image>>();
729 
730                 for (String listenerClassName : listenerClassNames) {
731                     listenersList.add((ModelListener<Image>)InstanceFactory.newInstance(
732                             listenerClassName));
733                 }
734 
735                 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
736             }
737             catch (Exception e) {
738                 _log.error(e);
739             }
740         }
741     }
742 
743     public void destroy() {
744         EntityCacheUtil.removeCache(ImageImpl.class.getName());
745         FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
746         FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
747     }
748 
749     @BeanReference(type = AccountPersistence.class)
750     protected AccountPersistence accountPersistence;
751     @BeanReference(type = AddressPersistence.class)
752     protected AddressPersistence addressPersistence;
753     @BeanReference(type = BrowserTrackerPersistence.class)
754     protected BrowserTrackerPersistence browserTrackerPersistence;
755     @BeanReference(type = ClassNamePersistence.class)
756     protected ClassNamePersistence classNamePersistence;
757     @BeanReference(type = CompanyPersistence.class)
758     protected CompanyPersistence companyPersistence;
759     @BeanReference(type = ContactPersistence.class)
760     protected ContactPersistence contactPersistence;
761     @BeanReference(type = CountryPersistence.class)
762     protected CountryPersistence countryPersistence;
763     @BeanReference(type = EmailAddressPersistence.class)
764     protected EmailAddressPersistence emailAddressPersistence;
765     @BeanReference(type = GroupPersistence.class)
766     protected GroupPersistence groupPersistence;
767     @BeanReference(type = ImagePersistence.class)
768     protected ImagePersistence imagePersistence;
769     @BeanReference(type = LayoutPersistence.class)
770     protected LayoutPersistence layoutPersistence;
771     @BeanReference(type = LayoutSetPersistence.class)
772     protected LayoutSetPersistence layoutSetPersistence;
773     @BeanReference(type = ListTypePersistence.class)
774     protected ListTypePersistence listTypePersistence;
775     @BeanReference(type = LockPersistence.class)
776     protected LockPersistence lockPersistence;
777     @BeanReference(type = MembershipRequestPersistence.class)
778     protected MembershipRequestPersistence membershipRequestPersistence;
779     @BeanReference(type = OrganizationPersistence.class)
780     protected OrganizationPersistence organizationPersistence;
781     @BeanReference(type = OrgGroupPermissionPersistence.class)
782     protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
783     @BeanReference(type = OrgGroupRolePersistence.class)
784     protected OrgGroupRolePersistence orgGroupRolePersistence;
785     @BeanReference(type = OrgLaborPersistence.class)
786     protected OrgLaborPersistence orgLaborPersistence;
787     @BeanReference(type = PasswordPolicyPersistence.class)
788     protected PasswordPolicyPersistence passwordPolicyPersistence;
789     @BeanReference(type = PasswordPolicyRelPersistence.class)
790     protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
791     @BeanReference(type = PasswordTrackerPersistence.class)
792     protected PasswordTrackerPersistence passwordTrackerPersistence;
793     @BeanReference(type = PermissionPersistence.class)
794     protected PermissionPersistence permissionPersistence;
795     @BeanReference(type = PhonePersistence.class)
796     protected PhonePersistence phonePersistence;
797     @BeanReference(type = PluginSettingPersistence.class)
798     protected PluginSettingPersistence pluginSettingPersistence;
799     @BeanReference(type = PortletPersistence.class)
800     protected PortletPersistence portletPersistence;
801     @BeanReference(type = PortletItemPersistence.class)
802     protected PortletItemPersistence portletItemPersistence;
803     @BeanReference(type = PortletPreferencesPersistence.class)
804     protected PortletPreferencesPersistence portletPreferencesPersistence;
805     @BeanReference(type = RegionPersistence.class)
806     protected RegionPersistence regionPersistence;
807     @BeanReference(type = ReleasePersistence.class)
808     protected ReleasePersistence releasePersistence;
809     @BeanReference(type = ResourcePersistence.class)
810     protected ResourcePersistence resourcePersistence;
811     @BeanReference(type = ResourceActionPersistence.class)
812     protected ResourceActionPersistence resourceActionPersistence;
813     @BeanReference(type = ResourceCodePersistence.class)
814     protected ResourceCodePersistence resourceCodePersistence;
815     @BeanReference(type = ResourcePermissionPersistence.class)
816     protected ResourcePermissionPersistence resourcePermissionPersistence;
817     @BeanReference(type = RolePersistence.class)
818     protected RolePersistence rolePersistence;
819     @BeanReference(type = ServiceComponentPersistence.class)
820     protected ServiceComponentPersistence serviceComponentPersistence;
821     @BeanReference(type = ShardPersistence.class)
822     protected ShardPersistence shardPersistence;
823     @BeanReference(type = SubscriptionPersistence.class)
824     protected SubscriptionPersistence subscriptionPersistence;
825     @BeanReference(type = UserPersistence.class)
826     protected UserPersistence userPersistence;
827     @BeanReference(type = UserGroupPersistence.class)
828     protected UserGroupPersistence userGroupPersistence;
829     @BeanReference(type = UserGroupGroupRolePersistence.class)
830     protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
831     @BeanReference(type = UserGroupRolePersistence.class)
832     protected UserGroupRolePersistence userGroupRolePersistence;
833     @BeanReference(type = UserIdMapperPersistence.class)
834     protected UserIdMapperPersistence userIdMapperPersistence;
835     @BeanReference(type = UserTrackerPersistence.class)
836     protected UserTrackerPersistence userTrackerPersistence;
837     @BeanReference(type = UserTrackerPathPersistence.class)
838     protected UserTrackerPathPersistence userTrackerPathPersistence;
839     @BeanReference(type = WebDAVPropsPersistence.class)
840     protected WebDAVPropsPersistence webDAVPropsPersistence;
841     @BeanReference(type = WebsitePersistence.class)
842     protected WebsitePersistence websitePersistence;
843     @BeanReference(type = IGImagePersistence.class)
844     protected IGImagePersistence igImagePersistence;
845     private static final String _SQL_SELECT_IMAGE = "SELECT image FROM Image image";
846     private static final String _SQL_SELECT_IMAGE_WHERE = "SELECT image FROM Image image WHERE ";
847     private static final String _SQL_COUNT_IMAGE = "SELECT COUNT(image) FROM Image image";
848     private static final String _SQL_COUNT_IMAGE_WHERE = "SELECT COUNT(image) FROM Image image WHERE ";
849     private static final String _FINDER_COLUMN_SIZE_SIZE_2 = "image.size < ?";
850     private static final String _ORDER_BY_ENTITY_ALIAS = "image.";
851     private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Image exists with the primary key ";
852     private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Image exists with the key {";
853     private static Log _log = LogFactoryUtil.getLog(ImagePersistenceImpl.class);
854 }