1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.asset.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.annotation.BeanReference;
19  import com.liferay.portal.kernel.cache.CacheRegistry;
20  import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
21  import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
22  import com.liferay.portal.kernel.dao.jdbc.RowMapper;
23  import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
24  import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
25  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
26  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
27  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
28  import com.liferay.portal.kernel.dao.orm.FinderPath;
29  import com.liferay.portal.kernel.dao.orm.Query;
30  import com.liferay.portal.kernel.dao.orm.QueryPos;
31  import com.liferay.portal.kernel.dao.orm.QueryUtil;
32  import com.liferay.portal.kernel.dao.orm.SQLQuery;
33  import com.liferay.portal.kernel.dao.orm.Session;
34  import com.liferay.portal.kernel.dao.orm.Type;
35  import com.liferay.portal.kernel.exception.SystemException;
36  import com.liferay.portal.kernel.log.Log;
37  import com.liferay.portal.kernel.log.LogFactoryUtil;
38  import com.liferay.portal.kernel.util.GetterUtil;
39  import com.liferay.portal.kernel.util.OrderByComparator;
40  import com.liferay.portal.kernel.util.SetUtil;
41  import com.liferay.portal.kernel.util.StringBundler;
42  import com.liferay.portal.kernel.util.StringPool;
43  import com.liferay.portal.kernel.util.StringUtil;
44  import com.liferay.portal.model.ModelListener;
45  import com.liferay.portal.service.persistence.BatchSessionUtil;
46  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47  
48  import com.liferay.portlet.asset.NoSuchTagException;
49  import com.liferay.portlet.asset.model.AssetTag;
50  import com.liferay.portlet.asset.model.impl.AssetTagImpl;
51  import com.liferay.portlet.asset.model.impl.AssetTagModelImpl;
52  
53  import java.io.Serializable;
54  
55  import java.sql.Types;
56  
57  import java.util.ArrayList;
58  import java.util.Collections;
59  import java.util.List;
60  import java.util.Set;
61  
62  /**
63   * <a href="AssetTagPersistenceImpl.java.html"><b><i>View Source</i></b></a>
64   *
65   * <p>
66   * ServiceBuilder generated this class. Modifications in this class will be
67   * overwritten the next time is generated.
68   * </p>
69   *
70   * @author    Brian Wing Shun Chan
71   * @see       AssetTagPersistence
72   * @see       AssetTagUtil
73   * @generated
74   */
75  public class AssetTagPersistenceImpl extends BasePersistenceImpl<AssetTag>
76      implements AssetTagPersistence {
77      public static final String FINDER_CLASS_NAME_ENTITY = AssetTagImpl.class.getName();
78      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
79          ".List";
80      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
81              AssetTagModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82              "findByGroupId", new String[] { Long.class.getName() });
83      public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
84              AssetTagModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
85              "findByGroupId",
86              new String[] {
87                  Long.class.getName(),
88                  
89              "java.lang.Integer", "java.lang.Integer",
90                  "com.liferay.portal.kernel.util.OrderByComparator"
91              });
92      public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
93              AssetTagModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
94              "countByGroupId", new String[] { Long.class.getName() });
95      public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
96              AssetTagModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
97              "findAll", new String[0]);
98      public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
99              AssetTagModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
100             "countAll", new String[0]);
101 
102     public void cacheResult(AssetTag assetTag) {
103         EntityCacheUtil.putResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
104             AssetTagImpl.class, assetTag.getPrimaryKey(), assetTag);
105     }
106 
107     public void cacheResult(List<AssetTag> assetTags) {
108         for (AssetTag assetTag : assetTags) {
109             if (EntityCacheUtil.getResult(
110                         AssetTagModelImpl.ENTITY_CACHE_ENABLED,
111                         AssetTagImpl.class, assetTag.getPrimaryKey(), this) == null) {
112                 cacheResult(assetTag);
113             }
114         }
115     }
116 
117     public void clearCache() {
118         CacheRegistry.clear(AssetTagImpl.class.getName());
119         EntityCacheUtil.clearCache(AssetTagImpl.class.getName());
120         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
121         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
122     }
123 
124     public AssetTag create(long tagId) {
125         AssetTag assetTag = new AssetTagImpl();
126 
127         assetTag.setNew(true);
128         assetTag.setPrimaryKey(tagId);
129 
130         return assetTag;
131     }
132 
133     public AssetTag remove(Serializable primaryKey)
134         throws NoSuchModelException, SystemException {
135         return remove(((Long)primaryKey).longValue());
136     }
137 
138     public AssetTag remove(long tagId)
139         throws NoSuchTagException, SystemException {
140         Session session = null;
141 
142         try {
143             session = openSession();
144 
145             AssetTag assetTag = (AssetTag)session.get(AssetTagImpl.class,
146                     new Long(tagId));
147 
148             if (assetTag == null) {
149                 if (_log.isWarnEnabled()) {
150                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagId);
151                 }
152 
153                 throw new NoSuchTagException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
154                     tagId);
155             }
156 
157             return remove(assetTag);
158         }
159         catch (NoSuchTagException nsee) {
160             throw nsee;
161         }
162         catch (Exception e) {
163             throw processException(e);
164         }
165         finally {
166             closeSession(session);
167         }
168     }
169 
170     public AssetTag remove(AssetTag assetTag) throws SystemException {
171         for (ModelListener<AssetTag> listener : listeners) {
172             listener.onBeforeRemove(assetTag);
173         }
174 
175         assetTag = removeImpl(assetTag);
176 
177         for (ModelListener<AssetTag> listener : listeners) {
178             listener.onAfterRemove(assetTag);
179         }
180 
181         return assetTag;
182     }
183 
184     protected AssetTag removeImpl(AssetTag assetTag) throws SystemException {
185         assetTag = toUnwrappedModel(assetTag);
186 
187         try {
188             clearAssetEntries.clear(assetTag.getPrimaryKey());
189         }
190         catch (Exception e) {
191             throw processException(e);
192         }
193         finally {
194             FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
195         }
196 
197         Session session = null;
198 
199         try {
200             session = openSession();
201 
202             if (assetTag.isCachedModel() || BatchSessionUtil.isEnabled()) {
203                 Object staleObject = session.get(AssetTagImpl.class,
204                         assetTag.getPrimaryKeyObj());
205 
206                 if (staleObject != null) {
207                     session.evict(staleObject);
208                 }
209             }
210 
211             session.delete(assetTag);
212 
213             session.flush();
214         }
215         catch (Exception e) {
216             throw processException(e);
217         }
218         finally {
219             closeSession(session);
220         }
221 
222         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
223 
224         EntityCacheUtil.removeResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
225             AssetTagImpl.class, assetTag.getPrimaryKey());
226 
227         return assetTag;
228     }
229 
230     public AssetTag updateImpl(
231         com.liferay.portlet.asset.model.AssetTag assetTag, boolean merge)
232         throws SystemException {
233         assetTag = toUnwrappedModel(assetTag);
234 
235         Session session = null;
236 
237         try {
238             session = openSession();
239 
240             BatchSessionUtil.update(session, assetTag, merge);
241 
242             assetTag.setNew(false);
243         }
244         catch (Exception e) {
245             throw processException(e);
246         }
247         finally {
248             closeSession(session);
249         }
250 
251         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
252 
253         EntityCacheUtil.putResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
254             AssetTagImpl.class, assetTag.getPrimaryKey(), assetTag);
255 
256         return assetTag;
257     }
258 
259     protected AssetTag toUnwrappedModel(AssetTag assetTag) {
260         if (assetTag instanceof AssetTagImpl) {
261             return assetTag;
262         }
263 
264         AssetTagImpl assetTagImpl = new AssetTagImpl();
265 
266         assetTagImpl.setNew(assetTag.isNew());
267         assetTagImpl.setPrimaryKey(assetTag.getPrimaryKey());
268 
269         assetTagImpl.setTagId(assetTag.getTagId());
270         assetTagImpl.setGroupId(assetTag.getGroupId());
271         assetTagImpl.setCompanyId(assetTag.getCompanyId());
272         assetTagImpl.setUserId(assetTag.getUserId());
273         assetTagImpl.setUserName(assetTag.getUserName());
274         assetTagImpl.setCreateDate(assetTag.getCreateDate());
275         assetTagImpl.setModifiedDate(assetTag.getModifiedDate());
276         assetTagImpl.setName(assetTag.getName());
277         assetTagImpl.setAssetCount(assetTag.getAssetCount());
278 
279         return assetTagImpl;
280     }
281 
282     public AssetTag findByPrimaryKey(Serializable primaryKey)
283         throws NoSuchModelException, SystemException {
284         return findByPrimaryKey(((Long)primaryKey).longValue());
285     }
286 
287     public AssetTag findByPrimaryKey(long tagId)
288         throws NoSuchTagException, SystemException {
289         AssetTag assetTag = fetchByPrimaryKey(tagId);
290 
291         if (assetTag == null) {
292             if (_log.isWarnEnabled()) {
293                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + tagId);
294             }
295 
296             throw new NoSuchTagException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
297                 tagId);
298         }
299 
300         return assetTag;
301     }
302 
303     public AssetTag fetchByPrimaryKey(Serializable primaryKey)
304         throws SystemException {
305         return fetchByPrimaryKey(((Long)primaryKey).longValue());
306     }
307 
308     public AssetTag fetchByPrimaryKey(long tagId) throws SystemException {
309         AssetTag assetTag = (AssetTag)EntityCacheUtil.getResult(AssetTagModelImpl.ENTITY_CACHE_ENABLED,
310                 AssetTagImpl.class, tagId, this);
311 
312         if (assetTag == null) {
313             Session session = null;
314 
315             try {
316                 session = openSession();
317 
318                 assetTag = (AssetTag)session.get(AssetTagImpl.class,
319                         new Long(tagId));
320             }
321             catch (Exception e) {
322                 throw processException(e);
323             }
324             finally {
325                 if (assetTag != null) {
326                     cacheResult(assetTag);
327                 }
328 
329                 closeSession(session);
330             }
331         }
332 
333         return assetTag;
334     }
335 
336     public List<AssetTag> findByGroupId(long groupId) throws SystemException {
337         Object[] finderArgs = new Object[] { new Long(groupId) };
338 
339         List<AssetTag> list = (List<AssetTag>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
340                 finderArgs, this);
341 
342         if (list == null) {
343             Session session = null;
344 
345             try {
346                 session = openSession();
347 
348                 StringBundler query = new StringBundler(3);
349 
350                 query.append(_SQL_SELECT_ASSETTAG_WHERE);
351 
352                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
353 
354                 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
355 
356                 String sql = query.toString();
357 
358                 Query q = session.createQuery(sql);
359 
360                 QueryPos qPos = QueryPos.getInstance(q);
361 
362                 qPos.add(groupId);
363 
364                 list = q.list();
365             }
366             catch (Exception e) {
367                 throw processException(e);
368             }
369             finally {
370                 if (list == null) {
371                     list = new ArrayList<AssetTag>();
372                 }
373 
374                 cacheResult(list);
375 
376                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
377                     finderArgs, list);
378 
379                 closeSession(session);
380             }
381         }
382 
383         return list;
384     }
385 
386     public List<AssetTag> findByGroupId(long groupId, int start, int end)
387         throws SystemException {
388         return findByGroupId(groupId, start, end, null);
389     }
390 
391     public List<AssetTag> findByGroupId(long groupId, int start, int end,
392         OrderByComparator obc) throws SystemException {
393         Object[] finderArgs = new Object[] {
394                 new Long(groupId),
395                 
396                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
397             };
398 
399         List<AssetTag> list = (List<AssetTag>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
400                 finderArgs, this);
401 
402         if (list == null) {
403             Session session = null;
404 
405             try {
406                 session = openSession();
407 
408                 StringBundler query = null;
409 
410                 if (obc != null) {
411                     query = new StringBundler(3 +
412                             (obc.getOrderByFields().length * 3));
413                 }
414                 else {
415                     query = new StringBundler(3);
416                 }
417 
418                 query.append(_SQL_SELECT_ASSETTAG_WHERE);
419 
420                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
421 
422                 if (obc != null) {
423                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
424                 }
425 
426                 else {
427                     query.append(AssetTagModelImpl.ORDER_BY_JPQL);
428                 }
429 
430                 String sql = query.toString();
431 
432                 Query q = session.createQuery(sql);
433 
434                 QueryPos qPos = QueryPos.getInstance(q);
435 
436                 qPos.add(groupId);
437 
438                 list = (List<AssetTag>)QueryUtil.list(q, getDialect(), start,
439                         end);
440             }
441             catch (Exception e) {
442                 throw processException(e);
443             }
444             finally {
445                 if (list == null) {
446                     list = new ArrayList<AssetTag>();
447                 }
448 
449                 cacheResult(list);
450 
451                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
452                     finderArgs, list);
453 
454                 closeSession(session);
455             }
456         }
457 
458         return list;
459     }
460 
461     public AssetTag findByGroupId_First(long groupId, OrderByComparator obc)
462         throws NoSuchTagException, SystemException {
463         List<AssetTag> list = findByGroupId(groupId, 0, 1, obc);
464 
465         if (list.isEmpty()) {
466             StringBundler msg = new StringBundler(4);
467 
468             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
469 
470             msg.append("groupId=");
471             msg.append(groupId);
472 
473             msg.append(StringPool.CLOSE_CURLY_BRACE);
474 
475             throw new NoSuchTagException(msg.toString());
476         }
477         else {
478             return list.get(0);
479         }
480     }
481 
482     public AssetTag findByGroupId_Last(long groupId, OrderByComparator obc)
483         throws NoSuchTagException, SystemException {
484         int count = countByGroupId(groupId);
485 
486         List<AssetTag> list = findByGroupId(groupId, count - 1, count, obc);
487 
488         if (list.isEmpty()) {
489             StringBundler msg = new StringBundler(4);
490 
491             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
492 
493             msg.append("groupId=");
494             msg.append(groupId);
495 
496             msg.append(StringPool.CLOSE_CURLY_BRACE);
497 
498             throw new NoSuchTagException(msg.toString());
499         }
500         else {
501             return list.get(0);
502         }
503     }
504 
505     public AssetTag[] findByGroupId_PrevAndNext(long tagId, long groupId,
506         OrderByComparator obc) throws NoSuchTagException, SystemException {
507         AssetTag assetTag = findByPrimaryKey(tagId);
508 
509         int count = countByGroupId(groupId);
510 
511         Session session = null;
512 
513         try {
514             session = openSession();
515 
516             StringBundler query = null;
517 
518             if (obc != null) {
519                 query = new StringBundler(3 +
520                         (obc.getOrderByFields().length * 3));
521             }
522             else {
523                 query = new StringBundler(3);
524             }
525 
526             query.append(_SQL_SELECT_ASSETTAG_WHERE);
527 
528             query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
529 
530             if (obc != null) {
531                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
532             }
533 
534             else {
535                 query.append(AssetTagModelImpl.ORDER_BY_JPQL);
536             }
537 
538             String sql = query.toString();
539 
540             Query q = session.createQuery(sql);
541 
542             QueryPos qPos = QueryPos.getInstance(q);
543 
544             qPos.add(groupId);
545 
546             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, assetTag);
547 
548             AssetTag[] array = new AssetTagImpl[3];
549 
550             array[0] = (AssetTag)objArray[0];
551             array[1] = (AssetTag)objArray[1];
552             array[2] = (AssetTag)objArray[2];
553 
554             return array;
555         }
556         catch (Exception e) {
557             throw processException(e);
558         }
559         finally {
560             closeSession(session);
561         }
562     }
563 
564     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
565         throws SystemException {
566         Session session = null;
567 
568         try {
569             session = openSession();
570 
571             dynamicQuery.compile(session);
572 
573             return dynamicQuery.list();
574         }
575         catch (Exception e) {
576             throw processException(e);
577         }
578         finally {
579             closeSession(session);
580         }
581     }
582 
583     public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
584         int start, int end) throws SystemException {
585         Session session = null;
586 
587         try {
588             session = openSession();
589 
590             dynamicQuery.setLimit(start, end);
591 
592             dynamicQuery.compile(session);
593 
594             return dynamicQuery.list();
595         }
596         catch (Exception e) {
597             throw processException(e);
598         }
599         finally {
600             closeSession(session);
601         }
602     }
603 
604     public List<AssetTag> findAll() throws SystemException {
605         return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
606     }
607 
608     public List<AssetTag> findAll(int start, int end) throws SystemException {
609         return findAll(start, end, null);
610     }
611 
612     public List<AssetTag> findAll(int start, int end, OrderByComparator obc)
613         throws SystemException {
614         Object[] finderArgs = new Object[] {
615                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
616             };
617 
618         List<AssetTag> list = (List<AssetTag>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
619                 finderArgs, this);
620 
621         if (list == null) {
622             Session session = null;
623 
624             try {
625                 session = openSession();
626 
627                 StringBundler query = null;
628                 String sql = null;
629 
630                 if (obc != null) {
631                     query = new StringBundler(2 +
632                             (obc.getOrderByFields().length * 3));
633 
634                     query.append(_SQL_SELECT_ASSETTAG);
635 
636                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
637 
638                     sql = query.toString();
639                 }
640 
641                 else {
642                     sql = _SQL_SELECT_ASSETTAG.concat(AssetTagModelImpl.ORDER_BY_JPQL);
643                 }
644 
645                 Query q = session.createQuery(sql);
646 
647                 if (obc == null) {
648                     list = (List<AssetTag>)QueryUtil.list(q, getDialect(),
649                             start, end, false);
650 
651                     Collections.sort(list);
652                 }
653                 else {
654                     list = (List<AssetTag>)QueryUtil.list(q, getDialect(),
655                             start, end);
656                 }
657             }
658             catch (Exception e) {
659                 throw processException(e);
660             }
661             finally {
662                 if (list == null) {
663                     list = new ArrayList<AssetTag>();
664                 }
665 
666                 cacheResult(list);
667 
668                 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
669 
670                 closeSession(session);
671             }
672         }
673 
674         return list;
675     }
676 
677     public void removeByGroupId(long groupId) throws SystemException {
678         for (AssetTag assetTag : findByGroupId(groupId)) {
679             remove(assetTag);
680         }
681     }
682 
683     public void removeAll() throws SystemException {
684         for (AssetTag assetTag : findAll()) {
685             remove(assetTag);
686         }
687     }
688 
689     public int countByGroupId(long groupId) throws SystemException {
690         Object[] finderArgs = new Object[] { new Long(groupId) };
691 
692         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
693                 finderArgs, this);
694 
695         if (count == null) {
696             Session session = null;
697 
698             try {
699                 session = openSession();
700 
701                 StringBundler query = new StringBundler(2);
702 
703                 query.append(_SQL_COUNT_ASSETTAG_WHERE);
704 
705                 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
706 
707                 String sql = query.toString();
708 
709                 Query q = session.createQuery(sql);
710 
711                 QueryPos qPos = QueryPos.getInstance(q);
712 
713                 qPos.add(groupId);
714 
715                 count = (Long)q.uniqueResult();
716             }
717             catch (Exception e) {
718                 throw processException(e);
719             }
720             finally {
721                 if (count == null) {
722                     count = Long.valueOf(0);
723                 }
724 
725                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
726                     finderArgs, count);
727 
728                 closeSession(session);
729             }
730         }
731 
732         return count.intValue();
733     }
734 
735     public int countAll() throws SystemException {
736         Object[] finderArgs = new Object[0];
737 
738         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
739                 finderArgs, this);
740 
741         if (count == null) {
742             Session session = null;
743 
744             try {
745                 session = openSession();
746 
747                 Query q = session.createQuery(_SQL_COUNT_ASSETTAG);
748 
749                 count = (Long)q.uniqueResult();
750             }
751             catch (Exception e) {
752                 throw processException(e);
753             }
754             finally {
755                 if (count == null) {
756                     count = Long.valueOf(0);
757                 }
758 
759                 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
760                     count);
761 
762                 closeSession(session);
763             }
764         }
765 
766         return count.intValue();
767     }
768 
769     public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
770         long pk) throws SystemException {
771         return getAssetEntries(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
772     }
773 
774     public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
775         long pk, int start, int end) throws SystemException {
776         return getAssetEntries(pk, start, end, null);
777     }
778 
779     public static final FinderPath FINDER_PATH_GET_ASSETENTRIES = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
780             AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
781             AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
782             "getAssetEntries",
783             new String[] {
784                 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
785                 "com.liferay.portal.kernel.util.OrderByComparator"
786             });
787 
788     public List<com.liferay.portlet.asset.model.AssetEntry> getAssetEntries(
789         long pk, int start, int end, OrderByComparator obc)
790         throws SystemException {
791         Object[] finderArgs = new Object[] {
792                 new Long(pk), String.valueOf(start), String.valueOf(end),
793                 String.valueOf(obc)
794             };
795 
796         List<com.liferay.portlet.asset.model.AssetEntry> list = (List<com.liferay.portlet.asset.model.AssetEntry>)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETENTRIES,
797                 finderArgs, this);
798 
799         if (list == null) {
800             Session session = null;
801 
802             try {
803                 session = openSession();
804 
805                 String sql = null;
806 
807                 if (obc != null) {
808                     sql = _SQL_GETASSETENTRIES.concat(ORDER_BY_CLAUSE)
809                                               .concat(obc.getOrderBy());
810                 }
811 
812                 sql = _SQL_GETASSETENTRIES;
813 
814                 SQLQuery q = session.createSQLQuery(sql);
815 
816                 q.addEntity("AssetEntry",
817                     com.liferay.portlet.asset.model.impl.AssetEntryImpl.class);
818 
819                 QueryPos qPos = QueryPos.getInstance(q);
820 
821                 qPos.add(pk);
822 
823                 list = (List<com.liferay.portlet.asset.model.AssetEntry>)QueryUtil.list(q,
824                         getDialect(), start, end);
825             }
826             catch (Exception e) {
827                 throw processException(e);
828             }
829             finally {
830                 if (list == null) {
831                     list = new ArrayList<com.liferay.portlet.asset.model.AssetEntry>();
832                 }
833 
834                 assetEntryPersistence.cacheResult(list);
835 
836                 FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETENTRIES,
837                     finderArgs, list);
838 
839                 closeSession(session);
840             }
841         }
842 
843         return list;
844     }
845 
846     public static final FinderPath FINDER_PATH_GET_ASSETENTRIES_SIZE = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
847             AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
848             AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
849             "getAssetEntriesSize", new String[] { Long.class.getName() });
850 
851     public int getAssetEntriesSize(long pk) throws SystemException {
852         Object[] finderArgs = new Object[] { new Long(pk) };
853 
854         Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_ASSETENTRIES_SIZE,
855                 finderArgs, this);
856 
857         if (count == null) {
858             Session session = null;
859 
860             try {
861                 session = openSession();
862 
863                 SQLQuery q = session.createSQLQuery(_SQL_GETASSETENTRIESSIZE);
864 
865                 q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
866 
867                 QueryPos qPos = QueryPos.getInstance(q);
868 
869                 qPos.add(pk);
870 
871                 count = (Long)q.uniqueResult();
872             }
873             catch (Exception e) {
874                 throw processException(e);
875             }
876             finally {
877                 if (count == null) {
878                     count = Long.valueOf(0);
879                 }
880 
881                 FinderCacheUtil.putResult(FINDER_PATH_GET_ASSETENTRIES_SIZE,
882                     finderArgs, count);
883 
884                 closeSession(session);
885             }
886         }
887 
888         return count.intValue();
889     }
890 
891     public static final FinderPath FINDER_PATH_CONTAINS_ASSETENTRY = new FinderPath(com.liferay.portlet.asset.model.impl.AssetEntryModelImpl.ENTITY_CACHE_ENABLED,
892             AssetTagModelImpl.FINDER_CACHE_ENABLED_ASSETENTRIES_ASSETTAGS,
893             AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME,
894             "containsAssetEntry",
895             new String[] { Long.class.getName(), Long.class.getName() });
896 
897     public boolean containsAssetEntry(long pk, long assetEntryPK)
898         throws SystemException {
899         Object[] finderArgs = new Object[] { new Long(pk), new Long(assetEntryPK) };
900 
901         Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_ASSETENTRY,
902                 finderArgs, this);
903 
904         if (value == null) {
905             try {
906                 value = Boolean.valueOf(containsAssetEntry.contains(pk,
907                             assetEntryPK));
908             }
909             catch (Exception e) {
910                 throw processException(e);
911             }
912             finally {
913                 if (value == null) {
914                     value = Boolean.FALSE;
915                 }
916 
917                 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_ASSETENTRY,
918                     finderArgs, value);
919             }
920         }
921 
922         return value.booleanValue();
923     }
924 
925     public boolean containsAssetEntries(long pk) throws SystemException {
926         if (getAssetEntriesSize(pk) > 0) {
927             return true;
928         }
929         else {
930             return false;
931         }
932     }
933 
934     public void addAssetEntry(long pk, long assetEntryPK)
935         throws SystemException {
936         try {
937             addAssetEntry.add(pk, assetEntryPK);
938         }
939         catch (Exception e) {
940             throw processException(e);
941         }
942         finally {
943             FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
944         }
945     }
946 
947     public void addAssetEntry(long pk,
948         com.liferay.portlet.asset.model.AssetEntry assetEntry)
949         throws SystemException {
950         try {
951             addAssetEntry.add(pk, assetEntry.getPrimaryKey());
952         }
953         catch (Exception e) {
954             throw processException(e);
955         }
956         finally {
957             FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
958         }
959     }
960 
961     public void addAssetEntries(long pk, long[] assetEntryPKs)
962         throws SystemException {
963         try {
964             for (long assetEntryPK : assetEntryPKs) {
965                 addAssetEntry.add(pk, assetEntryPK);
966             }
967         }
968         catch (Exception e) {
969             throw processException(e);
970         }
971         finally {
972             FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
973         }
974     }
975 
976     public void addAssetEntries(long pk,
977         List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
978         throws SystemException {
979         try {
980             for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
981                 addAssetEntry.add(pk, assetEntry.getPrimaryKey());
982             }
983         }
984         catch (Exception e) {
985             throw processException(e);
986         }
987         finally {
988             FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
989         }
990     }
991 
992     public void clearAssetEntries(long pk) throws SystemException {
993         try {
994             clearAssetEntries.clear(pk);
995         }
996         catch (Exception e) {
997             throw processException(e);
998         }
999         finally {
1000            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1001        }
1002    }
1003
1004    public void removeAssetEntry(long pk, long assetEntryPK)
1005        throws SystemException {
1006        try {
1007            removeAssetEntry.remove(pk, assetEntryPK);
1008        }
1009        catch (Exception e) {
1010            throw processException(e);
1011        }
1012        finally {
1013            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1014        }
1015    }
1016
1017    public void removeAssetEntry(long pk,
1018        com.liferay.portlet.asset.model.AssetEntry assetEntry)
1019        throws SystemException {
1020        try {
1021            removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
1022        }
1023        catch (Exception e) {
1024            throw processException(e);
1025        }
1026        finally {
1027            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1028        }
1029    }
1030
1031    public void removeAssetEntries(long pk, long[] assetEntryPKs)
1032        throws SystemException {
1033        try {
1034            for (long assetEntryPK : assetEntryPKs) {
1035                removeAssetEntry.remove(pk, assetEntryPK);
1036            }
1037        }
1038        catch (Exception e) {
1039            throw processException(e);
1040        }
1041        finally {
1042            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1043        }
1044    }
1045
1046    public void removeAssetEntries(long pk,
1047        List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
1048        throws SystemException {
1049        try {
1050            for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
1051                removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
1052            }
1053        }
1054        catch (Exception e) {
1055            throw processException(e);
1056        }
1057        finally {
1058            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1059        }
1060    }
1061
1062    public void setAssetEntries(long pk, long[] assetEntryPKs)
1063        throws SystemException {
1064        try {
1065            Set<Long> assetEntryPKSet = SetUtil.fromArray(assetEntryPKs);
1066
1067            List<com.liferay.portlet.asset.model.AssetEntry> assetEntries = getAssetEntries(pk);
1068
1069            for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
1070                if (!assetEntryPKSet.contains(assetEntry.getPrimaryKey())) {
1071                    removeAssetEntry.remove(pk, assetEntry.getPrimaryKey());
1072                }
1073                else {
1074                    assetEntryPKSet.remove(assetEntry.getPrimaryKey());
1075                }
1076            }
1077
1078            for (Long assetEntryPK : assetEntryPKSet) {
1079                addAssetEntry.add(pk, assetEntryPK);
1080            }
1081        }
1082        catch (Exception e) {
1083            throw processException(e);
1084        }
1085        finally {
1086            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1087        }
1088    }
1089
1090    public void setAssetEntries(long pk,
1091        List<com.liferay.portlet.asset.model.AssetEntry> assetEntries)
1092        throws SystemException {
1093        try {
1094            long[] assetEntryPKs = new long[assetEntries.size()];
1095
1096            for (int i = 0; i < assetEntries.size(); i++) {
1097                com.liferay.portlet.asset.model.AssetEntry assetEntry = assetEntries.get(i);
1098
1099                assetEntryPKs[i] = assetEntry.getPrimaryKey();
1100            }
1101
1102            setAssetEntries(pk, assetEntryPKs);
1103        }
1104        catch (Exception e) {
1105            throw processException(e);
1106        }
1107        finally {
1108            FinderCacheUtil.clearCache(AssetTagModelImpl.MAPPING_TABLE_ASSETENTRIES_ASSETTAGS_NAME);
1109        }
1110    }
1111
1112    public void afterPropertiesSet() {
1113        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1114                    com.liferay.portal.util.PropsUtil.get(
1115                        "value.object.listener.com.liferay.portlet.asset.model.AssetTag")));
1116
1117        if (listenerClassNames.length > 0) {
1118            try {
1119                List<ModelListener<AssetTag>> listenersList = new ArrayList<ModelListener<AssetTag>>();
1120
1121                for (String listenerClassName : listenerClassNames) {
1122                    listenersList.add((ModelListener<AssetTag>)Class.forName(
1123                            listenerClassName).newInstance());
1124                }
1125
1126                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1127            }
1128            catch (Exception e) {
1129                _log.error(e);
1130            }
1131        }
1132
1133        containsAssetEntry = new ContainsAssetEntry(this);
1134
1135        addAssetEntry = new AddAssetEntry(this);
1136        clearAssetEntries = new ClearAssetEntries(this);
1137        removeAssetEntry = new RemoveAssetEntry(this);
1138    }
1139
1140    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence")
1141    protected com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence assetCategoryPersistence;
1142    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyPersistence")
1143    protected com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
1144    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetEntryPersistence")
1145    protected com.liferay.portlet.asset.service.persistence.AssetEntryPersistence assetEntryPersistence;
1146    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetTagPersistence")
1147    protected com.liferay.portlet.asset.service.persistence.AssetTagPersistence assetTagPersistence;
1148    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetTagPropertyPersistence")
1149    protected com.liferay.portlet.asset.service.persistence.AssetTagPropertyPersistence assetTagPropertyPersistence;
1150    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetTagStatsPersistence")
1151    protected com.liferay.portlet.asset.service.persistence.AssetTagStatsPersistence assetTagStatsPersistence;
1152    @BeanReference(name = "com.liferay.portlet.asset.service.persistence.AssetVocabularyPersistence")
1153    protected com.liferay.portlet.asset.service.persistence.AssetVocabularyPersistence assetVocabularyPersistence;
1154    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
1155    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
1156    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
1157    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
1158    protected ContainsAssetEntry containsAssetEntry;
1159    protected AddAssetEntry addAssetEntry;
1160    protected ClearAssetEntries clearAssetEntries;
1161    protected RemoveAssetEntry removeAssetEntry;
1162
1163    protected class ContainsAssetEntry {
1164        protected ContainsAssetEntry(AssetTagPersistenceImpl persistenceImpl) {
1165            super();
1166
1167            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
1168                    _SQL_CONTAINSASSETENTRY,
1169                    new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
1170        }
1171
1172        protected boolean contains(long tagId, long entryId) {
1173            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
1174                        new Long(tagId), new Long(entryId)
1175                    });
1176
1177            if (results.size() > 0) {
1178                Integer count = results.get(0);
1179
1180                if (count.intValue() > 0) {
1181                    return true;
1182                }
1183            }
1184
1185            return false;
1186        }
1187
1188        private MappingSqlQuery<Integer> _mappingSqlQuery;
1189    }
1190
1191    protected class AddAssetEntry {
1192        protected AddAssetEntry(AssetTagPersistenceImpl persistenceImpl) {
1193            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1194                    "INSERT INTO AssetEntries_AssetTags (tagId, entryId) VALUES (?, ?)",
1195                    new int[] { Types.BIGINT, Types.BIGINT });
1196            _persistenceImpl = persistenceImpl;
1197        }
1198
1199        protected void add(long tagId, long entryId) throws SystemException {
1200            if (!_persistenceImpl.containsAssetEntry.contains(tagId, entryId)) {
1201                ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
1202                    assetEntryPersistence.getListeners();
1203
1204                for (ModelListener<AssetTag> listener : listeners) {
1205                    listener.onBeforeAddAssociation(tagId,
1206                        com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1207                        entryId);
1208                }
1209
1210                for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1211                    listener.onBeforeAddAssociation(entryId,
1212                        AssetTag.class.getName(), tagId);
1213                }
1214
1215                _sqlUpdate.update(new Object[] {
1216                        new Long(tagId), new Long(entryId)
1217                    });
1218
1219                for (ModelListener<AssetTag> listener : listeners) {
1220                    listener.onAfterAddAssociation(tagId,
1221                        com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1222                        entryId);
1223                }
1224
1225                for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1226                    listener.onAfterAddAssociation(entryId,
1227                        AssetTag.class.getName(), tagId);
1228                }
1229            }
1230        }
1231
1232        private SqlUpdate _sqlUpdate;
1233        private AssetTagPersistenceImpl _persistenceImpl;
1234    }
1235
1236    protected class ClearAssetEntries {
1237        protected ClearAssetEntries(AssetTagPersistenceImpl persistenceImpl) {
1238            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1239                    "DELETE FROM AssetEntries_AssetTags WHERE tagId = ?",
1240                    new int[] { Types.BIGINT });
1241        }
1242
1243        protected void clear(long tagId) throws SystemException {
1244            ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
1245                assetEntryPersistence.getListeners();
1246
1247            List<com.liferay.portlet.asset.model.AssetEntry> assetEntries = null;
1248
1249            if ((listeners.length > 0) || (assetEntryListeners.length > 0)) {
1250                assetEntries = getAssetEntries(tagId);
1251
1252                for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
1253                    for (ModelListener<AssetTag> listener : listeners) {
1254                        listener.onBeforeRemoveAssociation(tagId,
1255                            com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1256                            assetEntry.getPrimaryKey());
1257                    }
1258
1259                    for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1260                        listener.onBeforeRemoveAssociation(assetEntry.getPrimaryKey(),
1261                            AssetTag.class.getName(), tagId);
1262                    }
1263                }
1264            }
1265
1266            _sqlUpdate.update(new Object[] { new Long(tagId) });
1267
1268            if ((listeners.length > 0) || (assetEntryListeners.length > 0)) {
1269                for (com.liferay.portlet.asset.model.AssetEntry assetEntry : assetEntries) {
1270                    for (ModelListener<AssetTag> listener : listeners) {
1271                        listener.onAfterRemoveAssociation(tagId,
1272                            com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1273                            assetEntry.getPrimaryKey());
1274                    }
1275
1276                    for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1277                        listener.onAfterRemoveAssociation(assetEntry.getPrimaryKey(),
1278                            AssetTag.class.getName(), tagId);
1279                    }
1280                }
1281            }
1282        }
1283
1284        private SqlUpdate _sqlUpdate;
1285    }
1286
1287    protected class RemoveAssetEntry {
1288        protected RemoveAssetEntry(AssetTagPersistenceImpl persistenceImpl) {
1289            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
1290                    "DELETE FROM AssetEntries_AssetTags WHERE tagId = ? AND entryId = ?",
1291                    new int[] { Types.BIGINT, Types.BIGINT });
1292            _persistenceImpl = persistenceImpl;
1293        }
1294
1295        protected void remove(long tagId, long entryId)
1296            throws SystemException {
1297            if (_persistenceImpl.containsAssetEntry.contains(tagId, entryId)) {
1298                ModelListener<com.liferay.portlet.asset.model.AssetEntry>[] assetEntryListeners =
1299                    assetEntryPersistence.getListeners();
1300
1301                for (ModelListener<AssetTag> listener : listeners) {
1302                    listener.onBeforeRemoveAssociation(tagId,
1303                        com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1304                        entryId);
1305                }
1306
1307                for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1308                    listener.onBeforeRemoveAssociation(entryId,
1309                        AssetTag.class.getName(), tagId);
1310                }
1311
1312                _sqlUpdate.update(new Object[] {
1313                        new Long(tagId), new Long(entryId)
1314                    });
1315
1316                for (ModelListener<AssetTag> listener : listeners) {
1317                    listener.onAfterRemoveAssociation(tagId,
1318                        com.liferay.portlet.asset.model.AssetEntry.class.getName(),
1319                        entryId);
1320                }
1321
1322                for (ModelListener<com.liferay.portlet.asset.model.AssetEntry> listener : assetEntryListeners) {
1323                    listener.onAfterRemoveAssociation(entryId,
1324                        AssetTag.class.getName(), tagId);
1325                }
1326            }
1327        }
1328
1329        private SqlUpdate _sqlUpdate;
1330        private AssetTagPersistenceImpl _persistenceImpl;
1331    }
1332
1333    private static final String _SQL_SELECT_ASSETTAG = "SELECT assetTag FROM AssetTag assetTag";
1334    private static final String _SQL_SELECT_ASSETTAG_WHERE = "SELECT assetTag FROM AssetTag assetTag WHERE ";
1335    private static final String _SQL_COUNT_ASSETTAG = "SELECT COUNT(assetTag) FROM AssetTag assetTag";
1336    private static final String _SQL_COUNT_ASSETTAG_WHERE = "SELECT COUNT(assetTag) FROM AssetTag assetTag WHERE ";
1337    private static final String _SQL_GETASSETENTRIES = "SELECT {AssetEntry.*} FROM AssetEntry INNER JOIN AssetEntries_AssetTags ON (AssetEntries_AssetTags.entryId = AssetEntry.entryId) WHERE (AssetEntries_AssetTags.tagId = ?)";
1338    private static final String _SQL_GETASSETENTRIESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE tagId = ?";
1339    private static final String _SQL_CONTAINSASSETENTRY = "SELECT COUNT(*) AS COUNT_VALUE FROM AssetEntries_AssetTags WHERE tagId = ? AND entryId = ?";
1340    private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "assetTag.groupId = ?";
1341    private static final String _ORDER_BY_ENTITY_ALIAS = "assetTag.";
1342    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AssetTag exists with the primary key ";
1343    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AssetTag exists with the key {";
1344    private static Log _log = LogFactoryUtil.getLog(AssetTagPersistenceImpl.class);
1345}