001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.softwarecatalog.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.BeanReference;
018    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
020    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
021    import com.liferay.portal.kernel.dao.jdbc.RowMapper;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
025    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
026    import com.liferay.portal.kernel.dao.orm.FinderPath;
027    import com.liferay.portal.kernel.dao.orm.Query;
028    import com.liferay.portal.kernel.dao.orm.QueryPos;
029    import com.liferay.portal.kernel.dao.orm.QueryUtil;
030    import com.liferay.portal.kernel.dao.orm.SQLQuery;
031    import com.liferay.portal.kernel.dao.orm.Session;
032    import com.liferay.portal.kernel.exception.SystemException;
033    import com.liferay.portal.kernel.log.Log;
034    import com.liferay.portal.kernel.log.LogFactoryUtil;
035    import com.liferay.portal.kernel.util.GetterUtil;
036    import com.liferay.portal.kernel.util.InstanceFactory;
037    import com.liferay.portal.kernel.util.OrderByComparator;
038    import com.liferay.portal.kernel.util.SetUtil;
039    import com.liferay.portal.kernel.util.StringBundler;
040    import com.liferay.portal.kernel.util.StringPool;
041    import com.liferay.portal.kernel.util.StringUtil;
042    import com.liferay.portal.kernel.util.UnmodifiableList;
043    import com.liferay.portal.kernel.util.Validator;
044    import com.liferay.portal.model.CacheModel;
045    import com.liferay.portal.model.ModelListener;
046    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
047    
048    import com.liferay.portlet.softwarecatalog.NoSuchProductVersionException;
049    import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
050    import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl;
051    import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl;
052    
053    import java.io.Serializable;
054    
055    import java.util.ArrayList;
056    import java.util.Collections;
057    import java.util.List;
058    import java.util.Set;
059    
060    /**
061     * The persistence implementation for the s c product version service.
062     *
063     * <p>
064     * Caching information and settings can be found in <code>portal.properties</code>
065     * </p>
066     *
067     * @author Brian Wing Shun Chan
068     * @see SCProductVersionPersistence
069     * @see SCProductVersionUtil
070     * @generated
071     */
072    public class SCProductVersionPersistenceImpl extends BasePersistenceImpl<SCProductVersion>
073            implements SCProductVersionPersistence {
074            /*
075             * NOTE FOR DEVELOPERS:
076             *
077             * Never modify or reference this class directly. Always use {@link SCProductVersionUtil} to access the s c product version persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
078             */
079            public static final String FINDER_CLASS_NAME_ENTITY = SCProductVersionImpl.class.getName();
080            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081                    ".List1";
082            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083                    ".List2";
084            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
085                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
086                            SCProductVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
087                            "findAll", new String[0]);
088            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
089                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
090                            SCProductVersionImpl.class,
091                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
092            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
093                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
094                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
095            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PRODUCTENTRYID =
096                    new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
097                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
098                            SCProductVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
099                            "findByProductEntryId",
100                            new String[] {
101                                    Long.class.getName(),
102                                    
103                            Integer.class.getName(), Integer.class.getName(),
104                                    OrderByComparator.class.getName()
105                            });
106            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID =
107                    new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
108                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
109                            SCProductVersionImpl.class,
110                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByProductEntryId",
111                            new String[] { Long.class.getName() },
112                            SCProductVersionModelImpl.PRODUCTENTRYID_COLUMN_BITMASK |
113                            SCProductVersionModelImpl.CREATEDATE_COLUMN_BITMASK);
114            public static final FinderPath FINDER_PATH_COUNT_BY_PRODUCTENTRYID = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
115                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
116                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByProductEntryId",
117                            new String[] { Long.class.getName() });
118    
119            /**
120             * Returns all the s c product versions where productEntryId = &#63;.
121             *
122             * @param productEntryId the product entry ID
123             * @return the matching s c product versions
124             * @throws SystemException if a system exception occurred
125             */
126            public List<SCProductVersion> findByProductEntryId(long productEntryId)
127                    throws SystemException {
128                    return findByProductEntryId(productEntryId, QueryUtil.ALL_POS,
129                            QueryUtil.ALL_POS, null);
130            }
131    
132            /**
133             * Returns a range of all the s c product versions where productEntryId = &#63;.
134             *
135             * <p>
136             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
137             * </p>
138             *
139             * @param productEntryId the product entry ID
140             * @param start the lower bound of the range of s c product versions
141             * @param end the upper bound of the range of s c product versions (not inclusive)
142             * @return the range of matching s c product versions
143             * @throws SystemException if a system exception occurred
144             */
145            public List<SCProductVersion> findByProductEntryId(long productEntryId,
146                    int start, int end) throws SystemException {
147                    return findByProductEntryId(productEntryId, start, end, null);
148            }
149    
150            /**
151             * Returns an ordered range of all the s c product versions where productEntryId = &#63;.
152             *
153             * <p>
154             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
155             * </p>
156             *
157             * @param productEntryId the product entry ID
158             * @param start the lower bound of the range of s c product versions
159             * @param end the upper bound of the range of s c product versions (not inclusive)
160             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
161             * @return the ordered range of matching s c product versions
162             * @throws SystemException if a system exception occurred
163             */
164            public List<SCProductVersion> findByProductEntryId(long productEntryId,
165                    int start, int end, OrderByComparator orderByComparator)
166                    throws SystemException {
167                    boolean pagination = true;
168                    FinderPath finderPath = null;
169                    Object[] finderArgs = null;
170    
171                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
172                                    (orderByComparator == null)) {
173                            pagination = false;
174                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID;
175                            finderArgs = new Object[] { productEntryId };
176                    }
177                    else {
178                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PRODUCTENTRYID;
179                            finderArgs = new Object[] {
180                                            productEntryId,
181                                            
182                                            start, end, orderByComparator
183                                    };
184                    }
185    
186                    List<SCProductVersion> list = (List<SCProductVersion>)FinderCacheUtil.getResult(finderPath,
187                                    finderArgs, this);
188    
189                    if ((list != null) && !list.isEmpty()) {
190                            for (SCProductVersion scProductVersion : list) {
191                                    if ((productEntryId != scProductVersion.getProductEntryId())) {
192                                            list = null;
193    
194                                            break;
195                                    }
196                            }
197                    }
198    
199                    if (list == null) {
200                            StringBundler query = null;
201    
202                            if (orderByComparator != null) {
203                                    query = new StringBundler(3 +
204                                                    (orderByComparator.getOrderByFields().length * 3));
205                            }
206                            else {
207                                    query = new StringBundler(3);
208                            }
209    
210                            query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
211    
212                            query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
213    
214                            if (orderByComparator != null) {
215                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
216                                            orderByComparator);
217                            }
218                            else
219                             if (pagination) {
220                                    query.append(SCProductVersionModelImpl.ORDER_BY_JPQL);
221                            }
222    
223                            String sql = query.toString();
224    
225                            Session session = null;
226    
227                            try {
228                                    session = openSession();
229    
230                                    Query q = session.createQuery(sql);
231    
232                                    QueryPos qPos = QueryPos.getInstance(q);
233    
234                                    qPos.add(productEntryId);
235    
236                                    if (!pagination) {
237                                            list = (List<SCProductVersion>)QueryUtil.list(q,
238                                                            getDialect(), start, end, false);
239    
240                                            Collections.sort(list);
241    
242                                            list = new UnmodifiableList<SCProductVersion>(list);
243                                    }
244                                    else {
245                                            list = (List<SCProductVersion>)QueryUtil.list(q,
246                                                            getDialect(), start, end);
247                                    }
248    
249                                    cacheResult(list);
250    
251                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
252                            }
253                            catch (Exception e) {
254                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
255    
256                                    throw processException(e);
257                            }
258                            finally {
259                                    closeSession(session);
260                            }
261                    }
262    
263                    return list;
264            }
265    
266            /**
267             * Returns the first s c product version in the ordered set where productEntryId = &#63;.
268             *
269             * @param productEntryId the product entry ID
270             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
271             * @return the first matching s c product version
272             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
273             * @throws SystemException if a system exception occurred
274             */
275            public SCProductVersion findByProductEntryId_First(long productEntryId,
276                    OrderByComparator orderByComparator)
277                    throws NoSuchProductVersionException, SystemException {
278                    SCProductVersion scProductVersion = fetchByProductEntryId_First(productEntryId,
279                                    orderByComparator);
280    
281                    if (scProductVersion != null) {
282                            return scProductVersion;
283                    }
284    
285                    StringBundler msg = new StringBundler(4);
286    
287                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
288    
289                    msg.append("productEntryId=");
290                    msg.append(productEntryId);
291    
292                    msg.append(StringPool.CLOSE_CURLY_BRACE);
293    
294                    throw new NoSuchProductVersionException(msg.toString());
295            }
296    
297            /**
298             * Returns the first s c product version in the ordered set where productEntryId = &#63;.
299             *
300             * @param productEntryId the product entry ID
301             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
302             * @return the first matching s c product version, or <code>null</code> if a matching s c product version could not be found
303             * @throws SystemException if a system exception occurred
304             */
305            public SCProductVersion fetchByProductEntryId_First(long productEntryId,
306                    OrderByComparator orderByComparator) throws SystemException {
307                    List<SCProductVersion> list = findByProductEntryId(productEntryId, 0,
308                                    1, orderByComparator);
309    
310                    if (!list.isEmpty()) {
311                            return list.get(0);
312                    }
313    
314                    return null;
315            }
316    
317            /**
318             * Returns the last s c product version in the ordered set where productEntryId = &#63;.
319             *
320             * @param productEntryId the product entry ID
321             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
322             * @return the last matching s c product version
323             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
324             * @throws SystemException if a system exception occurred
325             */
326            public SCProductVersion findByProductEntryId_Last(long productEntryId,
327                    OrderByComparator orderByComparator)
328                    throws NoSuchProductVersionException, SystemException {
329                    SCProductVersion scProductVersion = fetchByProductEntryId_Last(productEntryId,
330                                    orderByComparator);
331    
332                    if (scProductVersion != null) {
333                            return scProductVersion;
334                    }
335    
336                    StringBundler msg = new StringBundler(4);
337    
338                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
339    
340                    msg.append("productEntryId=");
341                    msg.append(productEntryId);
342    
343                    msg.append(StringPool.CLOSE_CURLY_BRACE);
344    
345                    throw new NoSuchProductVersionException(msg.toString());
346            }
347    
348            /**
349             * Returns the last s c product version in the ordered set where productEntryId = &#63;.
350             *
351             * @param productEntryId the product entry ID
352             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
353             * @return the last matching s c product version, or <code>null</code> if a matching s c product version could not be found
354             * @throws SystemException if a system exception occurred
355             */
356            public SCProductVersion fetchByProductEntryId_Last(long productEntryId,
357                    OrderByComparator orderByComparator) throws SystemException {
358                    int count = countByProductEntryId(productEntryId);
359    
360                    List<SCProductVersion> list = findByProductEntryId(productEntryId,
361                                    count - 1, count, orderByComparator);
362    
363                    if (!list.isEmpty()) {
364                            return list.get(0);
365                    }
366    
367                    return null;
368            }
369    
370            /**
371             * Returns the s c product versions before and after the current s c product version in the ordered set where productEntryId = &#63;.
372             *
373             * @param productVersionId the primary key of the current s c product version
374             * @param productEntryId the product entry ID
375             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
376             * @return the previous, current, and next s c product version
377             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
378             * @throws SystemException if a system exception occurred
379             */
380            public SCProductVersion[] findByProductEntryId_PrevAndNext(
381                    long productVersionId, long productEntryId,
382                    OrderByComparator orderByComparator)
383                    throws NoSuchProductVersionException, SystemException {
384                    SCProductVersion scProductVersion = findByPrimaryKey(productVersionId);
385    
386                    Session session = null;
387    
388                    try {
389                            session = openSession();
390    
391                            SCProductVersion[] array = new SCProductVersionImpl[3];
392    
393                            array[0] = getByProductEntryId_PrevAndNext(session,
394                                            scProductVersion, productEntryId, orderByComparator, true);
395    
396                            array[1] = scProductVersion;
397    
398                            array[2] = getByProductEntryId_PrevAndNext(session,
399                                            scProductVersion, productEntryId, orderByComparator, false);
400    
401                            return array;
402                    }
403                    catch (Exception e) {
404                            throw processException(e);
405                    }
406                    finally {
407                            closeSession(session);
408                    }
409            }
410    
411            protected SCProductVersion getByProductEntryId_PrevAndNext(
412                    Session session, SCProductVersion scProductVersion,
413                    long productEntryId, OrderByComparator orderByComparator,
414                    boolean previous) {
415                    StringBundler query = null;
416    
417                    if (orderByComparator != null) {
418                            query = new StringBundler(6 +
419                                            (orderByComparator.getOrderByFields().length * 6));
420                    }
421                    else {
422                            query = new StringBundler(3);
423                    }
424    
425                    query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
426    
427                    query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
428    
429                    if (orderByComparator != null) {
430                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
431    
432                            if (orderByConditionFields.length > 0) {
433                                    query.append(WHERE_AND);
434                            }
435    
436                            for (int i = 0; i < orderByConditionFields.length; i++) {
437                                    query.append(_ORDER_BY_ENTITY_ALIAS);
438                                    query.append(orderByConditionFields[i]);
439    
440                                    if ((i + 1) < orderByConditionFields.length) {
441                                            if (orderByComparator.isAscending() ^ previous) {
442                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
443                                            }
444                                            else {
445                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
446                                            }
447                                    }
448                                    else {
449                                            if (orderByComparator.isAscending() ^ previous) {
450                                                    query.append(WHERE_GREATER_THAN);
451                                            }
452                                            else {
453                                                    query.append(WHERE_LESSER_THAN);
454                                            }
455                                    }
456                            }
457    
458                            query.append(ORDER_BY_CLAUSE);
459    
460                            String[] orderByFields = orderByComparator.getOrderByFields();
461    
462                            for (int i = 0; i < orderByFields.length; i++) {
463                                    query.append(_ORDER_BY_ENTITY_ALIAS);
464                                    query.append(orderByFields[i]);
465    
466                                    if ((i + 1) < orderByFields.length) {
467                                            if (orderByComparator.isAscending() ^ previous) {
468                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
469                                            }
470                                            else {
471                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
472                                            }
473                                    }
474                                    else {
475                                            if (orderByComparator.isAscending() ^ previous) {
476                                                    query.append(ORDER_BY_ASC);
477                                            }
478                                            else {
479                                                    query.append(ORDER_BY_DESC);
480                                            }
481                                    }
482                            }
483                    }
484                    else {
485                            query.append(SCProductVersionModelImpl.ORDER_BY_JPQL);
486                    }
487    
488                    String sql = query.toString();
489    
490                    Query q = session.createQuery(sql);
491    
492                    q.setFirstResult(0);
493                    q.setMaxResults(2);
494    
495                    QueryPos qPos = QueryPos.getInstance(q);
496    
497                    qPos.add(productEntryId);
498    
499                    if (orderByComparator != null) {
500                            Object[] values = orderByComparator.getOrderByConditionValues(scProductVersion);
501    
502                            for (Object value : values) {
503                                    qPos.add(value);
504                            }
505                    }
506    
507                    List<SCProductVersion> list = q.list();
508    
509                    if (list.size() == 2) {
510                            return list.get(1);
511                    }
512                    else {
513                            return null;
514                    }
515            }
516    
517            /**
518             * Removes all the s c product versions where productEntryId = &#63; from the database.
519             *
520             * @param productEntryId the product entry ID
521             * @throws SystemException if a system exception occurred
522             */
523            public void removeByProductEntryId(long productEntryId)
524                    throws SystemException {
525                    for (SCProductVersion scProductVersion : findByProductEntryId(
526                                    productEntryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
527                            remove(scProductVersion);
528                    }
529            }
530    
531            /**
532             * Returns the number of s c product versions where productEntryId = &#63;.
533             *
534             * @param productEntryId the product entry ID
535             * @return the number of matching s c product versions
536             * @throws SystemException if a system exception occurred
537             */
538            public int countByProductEntryId(long productEntryId)
539                    throws SystemException {
540                    FinderPath finderPath = FINDER_PATH_COUNT_BY_PRODUCTENTRYID;
541    
542                    Object[] finderArgs = new Object[] { productEntryId };
543    
544                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
545                                    this);
546    
547                    if (count == null) {
548                            StringBundler query = new StringBundler(2);
549    
550                            query.append(_SQL_COUNT_SCPRODUCTVERSION_WHERE);
551    
552                            query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
553    
554                            String sql = query.toString();
555    
556                            Session session = null;
557    
558                            try {
559                                    session = openSession();
560    
561                                    Query q = session.createQuery(sql);
562    
563                                    QueryPos qPos = QueryPos.getInstance(q);
564    
565                                    qPos.add(productEntryId);
566    
567                                    count = (Long)q.uniqueResult();
568    
569                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
570                            }
571                            catch (Exception e) {
572                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
573    
574                                    throw processException(e);
575                            }
576                            finally {
577                                    closeSession(session);
578                            }
579                    }
580    
581                    return count.intValue();
582            }
583    
584            private static final String _FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2 = "scProductVersion.productEntryId = ?";
585            public static final FinderPath FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
586                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
587                            SCProductVersionImpl.class, FINDER_CLASS_NAME_ENTITY,
588                            "fetchByDirectDownloadURL",
589                            new String[] { String.class.getName() },
590                            SCProductVersionModelImpl.DIRECTDOWNLOADURL_COLUMN_BITMASK);
591            public static final FinderPath FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
592                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
593                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
594                            "countByDirectDownloadURL", new String[] { String.class.getName() });
595    
596            /**
597             * Returns the s c product version where directDownloadURL = &#63; or throws a {@link com.liferay.portlet.softwarecatalog.NoSuchProductVersionException} if it could not be found.
598             *
599             * @param directDownloadURL the direct download u r l
600             * @return the matching s c product version
601             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
602             * @throws SystemException if a system exception occurred
603             */
604            public SCProductVersion findByDirectDownloadURL(String directDownloadURL)
605                    throws NoSuchProductVersionException, SystemException {
606                    SCProductVersion scProductVersion = fetchByDirectDownloadURL(directDownloadURL);
607    
608                    if (scProductVersion == null) {
609                            StringBundler msg = new StringBundler(4);
610    
611                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
612    
613                            msg.append("directDownloadURL=");
614                            msg.append(directDownloadURL);
615    
616                            msg.append(StringPool.CLOSE_CURLY_BRACE);
617    
618                            if (_log.isWarnEnabled()) {
619                                    _log.warn(msg.toString());
620                            }
621    
622                            throw new NoSuchProductVersionException(msg.toString());
623                    }
624    
625                    return scProductVersion;
626            }
627    
628            /**
629             * Returns the s c product version where directDownloadURL = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
630             *
631             * @param directDownloadURL the direct download u r l
632             * @return the matching s c product version, or <code>null</code> if a matching s c product version could not be found
633             * @throws SystemException if a system exception occurred
634             */
635            public SCProductVersion fetchByDirectDownloadURL(String directDownloadURL)
636                    throws SystemException {
637                    return fetchByDirectDownloadURL(directDownloadURL, true);
638            }
639    
640            /**
641             * Returns the s c product version where directDownloadURL = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
642             *
643             * @param directDownloadURL the direct download u r l
644             * @param retrieveFromCache whether to use the finder cache
645             * @return the matching s c product version, or <code>null</code> if a matching s c product version could not be found
646             * @throws SystemException if a system exception occurred
647             */
648            public SCProductVersion fetchByDirectDownloadURL(String directDownloadURL,
649                    boolean retrieveFromCache) throws SystemException {
650                    Object[] finderArgs = new Object[] { directDownloadURL };
651    
652                    Object result = null;
653    
654                    if (retrieveFromCache) {
655                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
656                                            finderArgs, this);
657                    }
658    
659                    if (result instanceof SCProductVersion) {
660                            SCProductVersion scProductVersion = (SCProductVersion)result;
661    
662                            if (!Validator.equals(directDownloadURL,
663                                                    scProductVersion.getDirectDownloadURL())) {
664                                    result = null;
665                            }
666                    }
667    
668                    if (result == null) {
669                            StringBundler query = new StringBundler(3);
670    
671                            query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
672    
673                            boolean bindDirectDownloadURL = false;
674    
675                            if (directDownloadURL == null) {
676                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1);
677                            }
678                            else if (directDownloadURL.equals(StringPool.BLANK)) {
679                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3);
680                            }
681                            else {
682                                    bindDirectDownloadURL = true;
683    
684                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_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                                    if (bindDirectDownloadURL) {
699                                            qPos.add(directDownloadURL.toLowerCase());
700                                    }
701    
702                                    List<SCProductVersion> list = q.list();
703    
704                                    if (list.isEmpty()) {
705                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
706                                                    finderArgs, list);
707                                    }
708                                    else {
709                                            if ((list.size() > 1) && _log.isWarnEnabled()) {
710                                                    _log.warn(
711                                                            "SCProductVersionPersistenceImpl.fetchByDirectDownloadURL(String, boolean) with parameters (" +
712                                                            StringUtil.merge(finderArgs) +
713                                                            ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
714                                            }
715    
716                                            SCProductVersion scProductVersion = list.get(0);
717    
718                                            result = scProductVersion;
719    
720                                            cacheResult(scProductVersion);
721    
722                                            if ((scProductVersion.getDirectDownloadURL() == null) ||
723                                                            !scProductVersion.getDirectDownloadURL()
724                                                                                                     .equals(directDownloadURL)) {
725                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
726                                                            finderArgs, scProductVersion);
727                                            }
728                                    }
729                            }
730                            catch (Exception e) {
731                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
732                                            finderArgs);
733    
734                                    throw processException(e);
735                            }
736                            finally {
737                                    closeSession(session);
738                            }
739                    }
740    
741                    if (result instanceof List<?>) {
742                            return null;
743                    }
744                    else {
745                            return (SCProductVersion)result;
746                    }
747            }
748    
749            /**
750             * Removes the s c product version where directDownloadURL = &#63; from the database.
751             *
752             * @param directDownloadURL the direct download u r l
753             * @return the s c product version that was removed
754             * @throws SystemException if a system exception occurred
755             */
756            public SCProductVersion removeByDirectDownloadURL(String directDownloadURL)
757                    throws NoSuchProductVersionException, SystemException {
758                    SCProductVersion scProductVersion = findByDirectDownloadURL(directDownloadURL);
759    
760                    return remove(scProductVersion);
761            }
762    
763            /**
764             * Returns the number of s c product versions where directDownloadURL = &#63;.
765             *
766             * @param directDownloadURL the direct download u r l
767             * @return the number of matching s c product versions
768             * @throws SystemException if a system exception occurred
769             */
770            public int countByDirectDownloadURL(String directDownloadURL)
771                    throws SystemException {
772                    FinderPath finderPath = FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL;
773    
774                    Object[] finderArgs = new Object[] { directDownloadURL };
775    
776                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
777                                    this);
778    
779                    if (count == null) {
780                            StringBundler query = new StringBundler(2);
781    
782                            query.append(_SQL_COUNT_SCPRODUCTVERSION_WHERE);
783    
784                            boolean bindDirectDownloadURL = false;
785    
786                            if (directDownloadURL == null) {
787                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1);
788                            }
789                            else if (directDownloadURL.equals(StringPool.BLANK)) {
790                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3);
791                            }
792                            else {
793                                    bindDirectDownloadURL = true;
794    
795                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_2);
796                            }
797    
798                            String sql = query.toString();
799    
800                            Session session = null;
801    
802                            try {
803                                    session = openSession();
804    
805                                    Query q = session.createQuery(sql);
806    
807                                    QueryPos qPos = QueryPos.getInstance(q);
808    
809                                    if (bindDirectDownloadURL) {
810                                            qPos.add(directDownloadURL.toLowerCase());
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_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1 =
831                    "scProductVersion.directDownloadURL IS NULL";
832            private static final String _FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_2 =
833                    "lower(scProductVersion.directDownloadURL) = ?";
834            private static final String _FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3 =
835                    "(scProductVersion.directDownloadURL IS NULL OR scProductVersion.directDownloadURL = '')";
836    
837            /**
838             * Caches the s c product version in the entity cache if it is enabled.
839             *
840             * @param scProductVersion the s c product version
841             */
842            public void cacheResult(SCProductVersion scProductVersion) {
843                    EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
844                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey(),
845                            scProductVersion);
846    
847                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
848                            new Object[] { scProductVersion.getDirectDownloadURL() },
849                            scProductVersion);
850    
851                    scProductVersion.resetOriginalValues();
852            }
853    
854            /**
855             * Caches the s c product versions in the entity cache if it is enabled.
856             *
857             * @param scProductVersions the s c product versions
858             */
859            public void cacheResult(List<SCProductVersion> scProductVersions) {
860                    for (SCProductVersion scProductVersion : scProductVersions) {
861                            if (EntityCacheUtil.getResult(
862                                                    SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
863                                                    SCProductVersionImpl.class,
864                                                    scProductVersion.getPrimaryKey()) == null) {
865                                    cacheResult(scProductVersion);
866                            }
867                            else {
868                                    scProductVersion.resetOriginalValues();
869                            }
870                    }
871            }
872    
873            /**
874             * Clears the cache for all s c product versions.
875             *
876             * <p>
877             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
878             * </p>
879             */
880            @Override
881            public void clearCache() {
882                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
883                            CacheRegistryUtil.clear(SCProductVersionImpl.class.getName());
884                    }
885    
886                    EntityCacheUtil.clearCache(SCProductVersionImpl.class.getName());
887    
888                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
889                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
890                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
891            }
892    
893            /**
894             * Clears the cache for the s c product version.
895             *
896             * <p>
897             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
898             * </p>
899             */
900            @Override
901            public void clearCache(SCProductVersion scProductVersion) {
902                    EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
903                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey());
904    
905                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
906                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
907    
908                    clearUniqueFindersCache(scProductVersion);
909            }
910    
911            @Override
912            public void clearCache(List<SCProductVersion> scProductVersions) {
913                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
914                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
915    
916                    for (SCProductVersion scProductVersion : scProductVersions) {
917                            EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
918                                    SCProductVersionImpl.class, scProductVersion.getPrimaryKey());
919    
920                            clearUniqueFindersCache(scProductVersion);
921                    }
922            }
923    
924            protected void cacheUniqueFindersCache(SCProductVersion scProductVersion) {
925                    if (scProductVersion.isNew()) {
926                            Object[] args = new Object[] { scProductVersion.getDirectDownloadURL() };
927    
928                            FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
929                                    args, Long.valueOf(1));
930                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
931                                    args, scProductVersion);
932                    }
933                    else {
934                            SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
935    
936                            if ((scProductVersionModelImpl.getColumnBitmask() &
937                                            FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL.getColumnBitmask()) != 0) {
938                                    Object[] args = new Object[] {
939                                                    scProductVersion.getDirectDownloadURL()
940                                            };
941    
942                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
943                                            args, Long.valueOf(1));
944                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
945                                            args, scProductVersion);
946                            }
947                    }
948            }
949    
950            protected void clearUniqueFindersCache(SCProductVersion scProductVersion) {
951                    SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
952    
953                    Object[] args = new Object[] { scProductVersion.getDirectDownloadURL() };
954    
955                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
956                            args);
957                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
958                            args);
959    
960                    if ((scProductVersionModelImpl.getColumnBitmask() &
961                                    FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL.getColumnBitmask()) != 0) {
962                            args = new Object[] {
963                                            scProductVersionModelImpl.getOriginalDirectDownloadURL()
964                                    };
965    
966                            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
967                                    args);
968                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
969                                    args);
970                    }
971            }
972    
973            /**
974             * Creates a new s c product version with the primary key. Does not add the s c product version to the database.
975             *
976             * @param productVersionId the primary key for the new s c product version
977             * @return the new s c product version
978             */
979            public SCProductVersion create(long productVersionId) {
980                    SCProductVersion scProductVersion = new SCProductVersionImpl();
981    
982                    scProductVersion.setNew(true);
983                    scProductVersion.setPrimaryKey(productVersionId);
984    
985                    return scProductVersion;
986            }
987    
988            /**
989             * Removes the s c product version with the primary key from the database. Also notifies the appropriate model listeners.
990             *
991             * @param productVersionId the primary key of the s c product version
992             * @return the s c product version that was removed
993             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
994             * @throws SystemException if a system exception occurred
995             */
996            public SCProductVersion remove(long productVersionId)
997                    throws NoSuchProductVersionException, SystemException {
998                    return remove((Serializable)productVersionId);
999            }
1000    
1001            /**
1002             * Removes the s c product version with the primary key from the database. Also notifies the appropriate model listeners.
1003             *
1004             * @param primaryKey the primary key of the s c product version
1005             * @return the s c product version that was removed
1006             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1007             * @throws SystemException if a system exception occurred
1008             */
1009            @Override
1010            public SCProductVersion remove(Serializable primaryKey)
1011                    throws NoSuchProductVersionException, SystemException {
1012                    Session session = null;
1013    
1014                    try {
1015                            session = openSession();
1016    
1017                            SCProductVersion scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1018                                            primaryKey);
1019    
1020                            if (scProductVersion == null) {
1021                                    if (_log.isWarnEnabled()) {
1022                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1023                                    }
1024    
1025                                    throw new NoSuchProductVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1026                                            primaryKey);
1027                            }
1028    
1029                            return remove(scProductVersion);
1030                    }
1031                    catch (NoSuchProductVersionException nsee) {
1032                            throw nsee;
1033                    }
1034                    catch (Exception e) {
1035                            throw processException(e);
1036                    }
1037                    finally {
1038                            closeSession(session);
1039                    }
1040            }
1041    
1042            @Override
1043            protected SCProductVersion removeImpl(SCProductVersion scProductVersion)
1044                    throws SystemException {
1045                    scProductVersion = toUnwrappedModel(scProductVersion);
1046    
1047                    try {
1048                            clearSCFrameworkVersions.clear(scProductVersion.getPrimaryKey());
1049                    }
1050                    catch (Exception e) {
1051                            throw processException(e);
1052                    }
1053                    finally {
1054                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1055                    }
1056    
1057                    Session session = null;
1058    
1059                    try {
1060                            session = openSession();
1061    
1062                            if (!session.contains(scProductVersion)) {
1063                                    scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1064                                                    scProductVersion.getPrimaryKeyObj());
1065                            }
1066    
1067                            if (scProductVersion != null) {
1068                                    session.delete(scProductVersion);
1069                            }
1070                    }
1071                    catch (Exception e) {
1072                            throw processException(e);
1073                    }
1074                    finally {
1075                            closeSession(session);
1076                    }
1077    
1078                    if (scProductVersion != null) {
1079                            clearCache(scProductVersion);
1080                    }
1081    
1082                    return scProductVersion;
1083            }
1084    
1085            @Override
1086            public SCProductVersion updateImpl(
1087                    com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
1088                    throws SystemException {
1089                    scProductVersion = toUnwrappedModel(scProductVersion);
1090    
1091                    boolean isNew = scProductVersion.isNew();
1092    
1093                    SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
1094    
1095                    Session session = null;
1096    
1097                    try {
1098                            session = openSession();
1099    
1100                            if (scProductVersion.isNew()) {
1101                                    session.save(scProductVersion);
1102    
1103                                    scProductVersion.setNew(false);
1104                            }
1105                            else {
1106                                    session.merge(scProductVersion);
1107                            }
1108                    }
1109                    catch (Exception e) {
1110                            throw processException(e);
1111                    }
1112                    finally {
1113                            closeSession(session);
1114                    }
1115    
1116                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1117    
1118                    if (isNew || !SCProductVersionModelImpl.COLUMN_BITMASK_ENABLED) {
1119                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1120                    }
1121    
1122                    else {
1123                            if ((scProductVersionModelImpl.getColumnBitmask() &
1124                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID.getColumnBitmask()) != 0) {
1125                                    Object[] args = new Object[] {
1126                                                    scProductVersionModelImpl.getOriginalProductEntryId()
1127                                            };
1128    
1129                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1130                                            args);
1131                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID,
1132                                            args);
1133    
1134                                    args = new Object[] {
1135                                                    scProductVersionModelImpl.getProductEntryId()
1136                                            };
1137    
1138                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1139                                            args);
1140                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID,
1141                                            args);
1142                            }
1143                    }
1144    
1145                    EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1146                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey(),
1147                            scProductVersion);
1148    
1149                    clearUniqueFindersCache(scProductVersion);
1150                    cacheUniqueFindersCache(scProductVersion);
1151    
1152                    return scProductVersion;
1153            }
1154    
1155            protected SCProductVersion toUnwrappedModel(
1156                    SCProductVersion scProductVersion) {
1157                    if (scProductVersion instanceof SCProductVersionImpl) {
1158                            return scProductVersion;
1159                    }
1160    
1161                    SCProductVersionImpl scProductVersionImpl = new SCProductVersionImpl();
1162    
1163                    scProductVersionImpl.setNew(scProductVersion.isNew());
1164                    scProductVersionImpl.setPrimaryKey(scProductVersion.getPrimaryKey());
1165    
1166                    scProductVersionImpl.setProductVersionId(scProductVersion.getProductVersionId());
1167                    scProductVersionImpl.setCompanyId(scProductVersion.getCompanyId());
1168                    scProductVersionImpl.setUserId(scProductVersion.getUserId());
1169                    scProductVersionImpl.setUserName(scProductVersion.getUserName());
1170                    scProductVersionImpl.setCreateDate(scProductVersion.getCreateDate());
1171                    scProductVersionImpl.setModifiedDate(scProductVersion.getModifiedDate());
1172                    scProductVersionImpl.setProductEntryId(scProductVersion.getProductEntryId());
1173                    scProductVersionImpl.setVersion(scProductVersion.getVersion());
1174                    scProductVersionImpl.setChangeLog(scProductVersion.getChangeLog());
1175                    scProductVersionImpl.setDownloadPageURL(scProductVersion.getDownloadPageURL());
1176                    scProductVersionImpl.setDirectDownloadURL(scProductVersion.getDirectDownloadURL());
1177                    scProductVersionImpl.setRepoStoreArtifact(scProductVersion.isRepoStoreArtifact());
1178    
1179                    return scProductVersionImpl;
1180            }
1181    
1182            /**
1183             * Returns the s c product version with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
1184             *
1185             * @param primaryKey the primary key of the s c product version
1186             * @return the s c product version
1187             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1188             * @throws SystemException if a system exception occurred
1189             */
1190            @Override
1191            public SCProductVersion findByPrimaryKey(Serializable primaryKey)
1192                    throws NoSuchProductVersionException, SystemException {
1193                    SCProductVersion scProductVersion = fetchByPrimaryKey(primaryKey);
1194    
1195                    if (scProductVersion == null) {
1196                            if (_log.isWarnEnabled()) {
1197                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1198                            }
1199    
1200                            throw new NoSuchProductVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1201                                    primaryKey);
1202                    }
1203    
1204                    return scProductVersion;
1205            }
1206    
1207            /**
1208             * Returns the s c product version with the primary key or throws a {@link com.liferay.portlet.softwarecatalog.NoSuchProductVersionException} if it could not be found.
1209             *
1210             * @param productVersionId the primary key of the s c product version
1211             * @return the s c product version
1212             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1213             * @throws SystemException if a system exception occurred
1214             */
1215            public SCProductVersion findByPrimaryKey(long productVersionId)
1216                    throws NoSuchProductVersionException, SystemException {
1217                    return findByPrimaryKey((Serializable)productVersionId);
1218            }
1219    
1220            /**
1221             * Returns the s c product version with the primary key or returns <code>null</code> if it could not be found.
1222             *
1223             * @param primaryKey the primary key of the s c product version
1224             * @return the s c product version, or <code>null</code> if a s c product version with the primary key could not be found
1225             * @throws SystemException if a system exception occurred
1226             */
1227            @Override
1228            public SCProductVersion fetchByPrimaryKey(Serializable primaryKey)
1229                    throws SystemException {
1230                    SCProductVersion scProductVersion = (SCProductVersion)EntityCacheUtil.getResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1231                                    SCProductVersionImpl.class, primaryKey);
1232    
1233                    if (scProductVersion == _nullSCProductVersion) {
1234                            return null;
1235                    }
1236    
1237                    if (scProductVersion == null) {
1238                            Session session = null;
1239    
1240                            try {
1241                                    session = openSession();
1242    
1243                                    scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1244                                                    primaryKey);
1245    
1246                                    if (scProductVersion != null) {
1247                                            cacheResult(scProductVersion);
1248                                    }
1249                                    else {
1250                                            EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1251                                                    SCProductVersionImpl.class, primaryKey,
1252                                                    _nullSCProductVersion);
1253                                    }
1254                            }
1255                            catch (Exception e) {
1256                                    EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1257                                            SCProductVersionImpl.class, primaryKey);
1258    
1259                                    throw processException(e);
1260                            }
1261                            finally {
1262                                    closeSession(session);
1263                            }
1264                    }
1265    
1266                    return scProductVersion;
1267            }
1268    
1269            /**
1270             * Returns the s c product version with the primary key or returns <code>null</code> if it could not be found.
1271             *
1272             * @param productVersionId the primary key of the s c product version
1273             * @return the s c product version, or <code>null</code> if a s c product version with the primary key could not be found
1274             * @throws SystemException if a system exception occurred
1275             */
1276            public SCProductVersion fetchByPrimaryKey(long productVersionId)
1277                    throws SystemException {
1278                    return fetchByPrimaryKey((Serializable)productVersionId);
1279            }
1280    
1281            /**
1282             * Returns all the s c product versions.
1283             *
1284             * @return the s c product versions
1285             * @throws SystemException if a system exception occurred
1286             */
1287            public List<SCProductVersion> findAll() throws SystemException {
1288                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1289            }
1290    
1291            /**
1292             * Returns a range of all the s c product versions.
1293             *
1294             * <p>
1295             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1296             * </p>
1297             *
1298             * @param start the lower bound of the range of s c product versions
1299             * @param end the upper bound of the range of s c product versions (not inclusive)
1300             * @return the range of s c product versions
1301             * @throws SystemException if a system exception occurred
1302             */
1303            public List<SCProductVersion> findAll(int start, int end)
1304                    throws SystemException {
1305                    return findAll(start, end, null);
1306            }
1307    
1308            /**
1309             * Returns an ordered range of all the s c product versions.
1310             *
1311             * <p>
1312             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1313             * </p>
1314             *
1315             * @param start the lower bound of the range of s c product versions
1316             * @param end the upper bound of the range of s c product versions (not inclusive)
1317             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1318             * @return the ordered range of s c product versions
1319             * @throws SystemException if a system exception occurred
1320             */
1321            public List<SCProductVersion> findAll(int start, int end,
1322                    OrderByComparator orderByComparator) throws SystemException {
1323                    boolean pagination = true;
1324                    FinderPath finderPath = null;
1325                    Object[] finderArgs = null;
1326    
1327                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1328                                    (orderByComparator == null)) {
1329                            pagination = false;
1330                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1331                            finderArgs = FINDER_ARGS_EMPTY;
1332                    }
1333                    else {
1334                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1335                            finderArgs = new Object[] { start, end, orderByComparator };
1336                    }
1337    
1338                    List<SCProductVersion> list = (List<SCProductVersion>)FinderCacheUtil.getResult(finderPath,
1339                                    finderArgs, this);
1340    
1341                    if (list == null) {
1342                            StringBundler query = null;
1343                            String sql = null;
1344    
1345                            if (orderByComparator != null) {
1346                                    query = new StringBundler(2 +
1347                                                    (orderByComparator.getOrderByFields().length * 3));
1348    
1349                                    query.append(_SQL_SELECT_SCPRODUCTVERSION);
1350    
1351                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1352                                            orderByComparator);
1353    
1354                                    sql = query.toString();
1355                            }
1356                            else {
1357                                    sql = _SQL_SELECT_SCPRODUCTVERSION;
1358    
1359                                    if (pagination) {
1360                                            sql = sql.concat(SCProductVersionModelImpl.ORDER_BY_JPQL);
1361                                    }
1362                            }
1363    
1364                            Session session = null;
1365    
1366                            try {
1367                                    session = openSession();
1368    
1369                                    Query q = session.createQuery(sql);
1370    
1371                                    if (!pagination) {
1372                                            list = (List<SCProductVersion>)QueryUtil.list(q,
1373                                                            getDialect(), start, end, false);
1374    
1375                                            Collections.sort(list);
1376    
1377                                            list = new UnmodifiableList<SCProductVersion>(list);
1378                                    }
1379                                    else {
1380                                            list = (List<SCProductVersion>)QueryUtil.list(q,
1381                                                            getDialect(), start, end);
1382                                    }
1383    
1384                                    cacheResult(list);
1385    
1386                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1387                            }
1388                            catch (Exception e) {
1389                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1390    
1391                                    throw processException(e);
1392                            }
1393                            finally {
1394                                    closeSession(session);
1395                            }
1396                    }
1397    
1398                    return list;
1399            }
1400    
1401            /**
1402             * Removes all the s c product versions from the database.
1403             *
1404             * @throws SystemException if a system exception occurred
1405             */
1406            public void removeAll() throws SystemException {
1407                    for (SCProductVersion scProductVersion : findAll()) {
1408                            remove(scProductVersion);
1409                    }
1410            }
1411    
1412            /**
1413             * Returns the number of s c product versions.
1414             *
1415             * @return the number of s c product versions
1416             * @throws SystemException if a system exception occurred
1417             */
1418            public int countAll() throws SystemException {
1419                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1420                                    FINDER_ARGS_EMPTY, this);
1421    
1422                    if (count == null) {
1423                            Session session = null;
1424    
1425                            try {
1426                                    session = openSession();
1427    
1428                                    Query q = session.createQuery(_SQL_COUNT_SCPRODUCTVERSION);
1429    
1430                                    count = (Long)q.uniqueResult();
1431    
1432                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1433                                            FINDER_ARGS_EMPTY, count);
1434                            }
1435                            catch (Exception e) {
1436                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1437                                            FINDER_ARGS_EMPTY);
1438    
1439                                    throw processException(e);
1440                            }
1441                            finally {
1442                                    closeSession(session);
1443                            }
1444                    }
1445    
1446                    return count.intValue();
1447            }
1448    
1449            /**
1450             * Returns all the s c framework versions associated with the s c product version.
1451             *
1452             * @param pk the primary key of the s c product version
1453             * @return the s c framework versions associated with the s c product version
1454             * @throws SystemException if a system exception occurred
1455             */
1456            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1457                    long pk) throws SystemException {
1458                    return getSCFrameworkVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1459            }
1460    
1461            /**
1462             * Returns a range of all the s c framework versions associated with the s c product version.
1463             *
1464             * <p>
1465             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1466             * </p>
1467             *
1468             * @param pk the primary key of the s c product version
1469             * @param start the lower bound of the range of s c product versions
1470             * @param end the upper bound of the range of s c product versions (not inclusive)
1471             * @return the range of s c framework versions associated with the s c product version
1472             * @throws SystemException if a system exception occurred
1473             */
1474            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1475                    long pk, int start, int end) throws SystemException {
1476                    return getSCFrameworkVersions(pk, start, end, null);
1477            }
1478    
1479            public static final FinderPath FINDER_PATH_GET_SCFRAMEWORKVERSIONS = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1480                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1481                            com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl.class,
1482                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1483                            "getSCFrameworkVersions",
1484                            new String[] {
1485                                    Long.class.getName(), Integer.class.getName(),
1486                                    Integer.class.getName(), OrderByComparator.class.getName()
1487                            });
1488    
1489            static {
1490                    FINDER_PATH_GET_SCFRAMEWORKVERSIONS.setCacheKeyGeneratorCacheName(null);
1491            }
1492    
1493            /**
1494             * Returns an ordered range of all the s c framework versions associated with the s c product version.
1495             *
1496             * <p>
1497             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1498             * </p>
1499             *
1500             * @param pk the primary key of the s c product version
1501             * @param start the lower bound of the range of s c product versions
1502             * @param end the upper bound of the range of s c product versions (not inclusive)
1503             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1504             * @return the ordered range of s c framework versions associated with the s c product version
1505             * @throws SystemException if a system exception occurred
1506             */
1507            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1508                    long pk, int start, int end, OrderByComparator orderByComparator)
1509                    throws SystemException {
1510                    boolean pagination = true;
1511                    Object[] finderArgs = null;
1512    
1513                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1514                                    (orderByComparator == null)) {
1515                            pagination = false;
1516                            finderArgs = new Object[] { pk };
1517                    }
1518                    else {
1519                            finderArgs = new Object[] { pk, start, end, orderByComparator };
1520                    }
1521    
1522                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1523                                    finderArgs, this);
1524    
1525                    if (list == null) {
1526                            Session session = null;
1527    
1528                            try {
1529                                    session = openSession();
1530    
1531                                    String sql = null;
1532    
1533                                    if (orderByComparator != null) {
1534                                            sql = _SQL_GETSCFRAMEWORKVERSIONS.concat(ORDER_BY_CLAUSE)
1535                                                                                                             .concat(orderByComparator.getOrderBy());
1536                                    }
1537                                    else {
1538                                            sql = _SQL_GETSCFRAMEWORKVERSIONS;
1539    
1540                                            if (pagination) {
1541                                                    sql = sql.concat(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ORDER_BY_SQL);
1542                                            }
1543                                    }
1544    
1545                                    SQLQuery q = session.createSQLQuery(sql);
1546    
1547                                    q.addEntity("SCFrameworkVersion",
1548                                            com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl.class);
1549    
1550                                    QueryPos qPos = QueryPos.getInstance(q);
1551    
1552                                    qPos.add(pk);
1553    
1554                                    if (!pagination) {
1555                                            list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)QueryUtil.list(q,
1556                                                            getDialect(), start, end, false);
1557    
1558                                            Collections.sort(list);
1559    
1560                                            list = new UnmodifiableList<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>(list);
1561                                    }
1562                                    else {
1563                                            list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)QueryUtil.list(q,
1564                                                            getDialect(), start, end);
1565                                    }
1566    
1567                                    scFrameworkVersionPersistence.cacheResult(list);
1568    
1569                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1570                                            finderArgs, list);
1571                            }
1572                            catch (Exception e) {
1573                                    FinderCacheUtil.removeResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1574                                            finderArgs);
1575    
1576                                    throw processException(e);
1577                            }
1578                            finally {
1579                                    closeSession(session);
1580                            }
1581                    }
1582    
1583                    return list;
1584            }
1585    
1586            public static final FinderPath FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1587                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1588                            Long.class,
1589                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1590                            "getSCFrameworkVersionsSize", new String[] { Long.class.getName() });
1591    
1592            static {
1593                    FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE.setCacheKeyGeneratorCacheName(null);
1594            }
1595    
1596            /**
1597             * Returns the number of s c framework versions associated with the s c product version.
1598             *
1599             * @param pk the primary key of the s c product version
1600             * @return the number of s c framework versions associated with the s c product version
1601             * @throws SystemException if a system exception occurred
1602             */
1603            public int getSCFrameworkVersionsSize(long pk) throws SystemException {
1604                    Object[] finderArgs = new Object[] { pk };
1605    
1606                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1607                                    finderArgs, this);
1608    
1609                    if (count == null) {
1610                            Session session = null;
1611    
1612                            try {
1613                                    session = openSession();
1614    
1615                                    SQLQuery q = session.createSQLQuery(_SQL_GETSCFRAMEWORKVERSIONSSIZE);
1616    
1617                                    q.addScalar(COUNT_COLUMN_NAME,
1618                                            com.liferay.portal.kernel.dao.orm.Type.LONG);
1619    
1620                                    QueryPos qPos = QueryPos.getInstance(q);
1621    
1622                                    qPos.add(pk);
1623    
1624                                    count = (Long)q.uniqueResult();
1625    
1626                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1627                                            finderArgs, count);
1628                            }
1629                            catch (Exception e) {
1630                                    FinderCacheUtil.removeResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1631                                            finderArgs);
1632    
1633                                    throw processException(e);
1634                            }
1635                            finally {
1636                                    closeSession(session);
1637                            }
1638                    }
1639    
1640                    return count.intValue();
1641            }
1642    
1643            public static final FinderPath FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1644                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1645                            Boolean.class,
1646                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1647                            "containsSCFrameworkVersion",
1648                            new String[] { Long.class.getName(), Long.class.getName() });
1649    
1650            /**
1651             * Returns <code>true</code> if the s c framework version is associated with the s c product version.
1652             *
1653             * @param pk the primary key of the s c product version
1654             * @param scFrameworkVersionPK the primary key of the s c framework version
1655             * @return <code>true</code> if the s c framework version is associated with the s c product version; <code>false</code> otherwise
1656             * @throws SystemException if a system exception occurred
1657             */
1658            public boolean containsSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1659                    throws SystemException {
1660                    Object[] finderArgs = new Object[] { pk, scFrameworkVersionPK };
1661    
1662                    Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1663                                    finderArgs, this);
1664    
1665                    if (value == null) {
1666                            try {
1667                                    value = Boolean.valueOf(containsSCFrameworkVersion.contains(
1668                                                            pk, scFrameworkVersionPK));
1669    
1670                                    FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1671                                            finderArgs, value);
1672                            }
1673                            catch (Exception e) {
1674                                    FinderCacheUtil.removeResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1675                                            finderArgs);
1676    
1677                                    throw processException(e);
1678                            }
1679                    }
1680    
1681                    return value.booleanValue();
1682            }
1683    
1684            /**
1685             * Returns <code>true</code> if the s c product version has any s c framework versions associated with it.
1686             *
1687             * @param pk the primary key of the s c product version to check for associations with s c framework versions
1688             * @return <code>true</code> if the s c product version has any s c framework versions associated with it; <code>false</code> otherwise
1689             * @throws SystemException if a system exception occurred
1690             */
1691            public boolean containsSCFrameworkVersions(long pk)
1692                    throws SystemException {
1693                    if (getSCFrameworkVersionsSize(pk) > 0) {
1694                            return true;
1695                    }
1696                    else {
1697                            return false;
1698                    }
1699            }
1700    
1701            /**
1702             * Adds an association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1703             *
1704             * @param pk the primary key of the s c product version
1705             * @param scFrameworkVersionPK the primary key of the s c framework version
1706             * @throws SystemException if a system exception occurred
1707             */
1708            public void addSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1709                    throws SystemException {
1710                    try {
1711                            addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1712                    }
1713                    catch (Exception e) {
1714                            throw processException(e);
1715                    }
1716                    finally {
1717                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1718                    }
1719            }
1720    
1721            /**
1722             * Adds an association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1723             *
1724             * @param pk the primary key of the s c product version
1725             * @param scFrameworkVersion the s c framework version
1726             * @throws SystemException if a system exception occurred
1727             */
1728            public void addSCFrameworkVersion(long pk,
1729                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1730                    throws SystemException {
1731                    try {
1732                            addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1733                    }
1734                    catch (Exception e) {
1735                            throw processException(e);
1736                    }
1737                    finally {
1738                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1739                    }
1740            }
1741    
1742            /**
1743             * Adds an association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1744             *
1745             * @param pk the primary key of the s c product version
1746             * @param scFrameworkVersionPKs the primary keys of the s c framework versions
1747             * @throws SystemException if a system exception occurred
1748             */
1749            public void addSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1750                    throws SystemException {
1751                    try {
1752                            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1753                                    addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1754                            }
1755                    }
1756                    catch (Exception e) {
1757                            throw processException(e);
1758                    }
1759                    finally {
1760                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1761                    }
1762            }
1763    
1764            /**
1765             * Adds an association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1766             *
1767             * @param pk the primary key of the s c product version
1768             * @param scFrameworkVersions the s c framework versions
1769             * @throws SystemException if a system exception occurred
1770             */
1771            public void addSCFrameworkVersions(long pk,
1772                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1773                    throws SystemException {
1774                    try {
1775                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1776                                    addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1777                            }
1778                    }
1779                    catch (Exception e) {
1780                            throw processException(e);
1781                    }
1782                    finally {
1783                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1784                    }
1785            }
1786    
1787            /**
1788             * Clears all associations between the s c product version and its s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1789             *
1790             * @param pk the primary key of the s c product version to clear the associated s c framework versions from
1791             * @throws SystemException if a system exception occurred
1792             */
1793            public void clearSCFrameworkVersions(long pk) throws SystemException {
1794                    try {
1795                            clearSCFrameworkVersions.clear(pk);
1796                    }
1797                    catch (Exception e) {
1798                            throw processException(e);
1799                    }
1800                    finally {
1801                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1802                    }
1803            }
1804    
1805            /**
1806             * Removes the association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1807             *
1808             * @param pk the primary key of the s c product version
1809             * @param scFrameworkVersionPK the primary key of the s c framework version
1810             * @throws SystemException if a system exception occurred
1811             */
1812            public void removeSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1813                    throws SystemException {
1814                    try {
1815                            removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1816                    }
1817                    catch (Exception e) {
1818                            throw processException(e);
1819                    }
1820                    finally {
1821                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1822                    }
1823            }
1824    
1825            /**
1826             * Removes the association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1827             *
1828             * @param pk the primary key of the s c product version
1829             * @param scFrameworkVersion the s c framework version
1830             * @throws SystemException if a system exception occurred
1831             */
1832            public void removeSCFrameworkVersion(long pk,
1833                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1834                    throws SystemException {
1835                    try {
1836                            removeSCFrameworkVersion.remove(pk,
1837                                    scFrameworkVersion.getPrimaryKey());
1838                    }
1839                    catch (Exception e) {
1840                            throw processException(e);
1841                    }
1842                    finally {
1843                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1844                    }
1845            }
1846    
1847            /**
1848             * Removes the association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1849             *
1850             * @param pk the primary key of the s c product version
1851             * @param scFrameworkVersionPKs the primary keys of the s c framework versions
1852             * @throws SystemException if a system exception occurred
1853             */
1854            public void removeSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1855                    throws SystemException {
1856                    try {
1857                            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1858                                    removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1859                            }
1860                    }
1861                    catch (Exception e) {
1862                            throw processException(e);
1863                    }
1864                    finally {
1865                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1866                    }
1867            }
1868    
1869            /**
1870             * Removes the association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1871             *
1872             * @param pk the primary key of the s c product version
1873             * @param scFrameworkVersions the s c framework versions
1874             * @throws SystemException if a system exception occurred
1875             */
1876            public void removeSCFrameworkVersions(long pk,
1877                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1878                    throws SystemException {
1879                    try {
1880                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1881                                    removeSCFrameworkVersion.remove(pk,
1882                                            scFrameworkVersion.getPrimaryKey());
1883                            }
1884                    }
1885                    catch (Exception e) {
1886                            throw processException(e);
1887                    }
1888                    finally {
1889                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1890                    }
1891            }
1892    
1893            /**
1894             * Sets the s c framework versions associated with the s c product version, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1895             *
1896             * @param pk the primary key of the s c product version
1897             * @param scFrameworkVersionPKs the primary keys of the s c framework versions to be associated with the s c product version
1898             * @throws SystemException if a system exception occurred
1899             */
1900            public void setSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1901                    throws SystemException {
1902                    try {
1903                            Set<Long> scFrameworkVersionPKSet = SetUtil.fromArray(scFrameworkVersionPKs);
1904    
1905                            List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions =
1906                                    getSCFrameworkVersions(pk);
1907    
1908                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1909                                    if (!scFrameworkVersionPKSet.remove(
1910                                                            scFrameworkVersion.getPrimaryKey())) {
1911                                            removeSCFrameworkVersion.remove(pk,
1912                                                    scFrameworkVersion.getPrimaryKey());
1913                                    }
1914                            }
1915    
1916                            for (Long scFrameworkVersionPK : scFrameworkVersionPKSet) {
1917                                    addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1918                            }
1919                    }
1920                    catch (Exception e) {
1921                            throw processException(e);
1922                    }
1923                    finally {
1924                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1925                    }
1926            }
1927    
1928            /**
1929             * Sets the s c framework versions associated with the s c product version, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1930             *
1931             * @param pk the primary key of the s c product version
1932             * @param scFrameworkVersions the s c framework versions to be associated with the s c product version
1933             * @throws SystemException if a system exception occurred
1934             */
1935            public void setSCFrameworkVersions(long pk,
1936                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1937                    throws SystemException {
1938                    try {
1939                            long[] scFrameworkVersionPKs = new long[scFrameworkVersions.size()];
1940    
1941                            for (int i = 0; i < scFrameworkVersions.size(); i++) {
1942                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion =
1943                                            scFrameworkVersions.get(i);
1944    
1945                                    scFrameworkVersionPKs[i] = scFrameworkVersion.getPrimaryKey();
1946                            }
1947    
1948                            setSCFrameworkVersions(pk, scFrameworkVersionPKs);
1949                    }
1950                    catch (Exception e) {
1951                            throw processException(e);
1952                    }
1953                    finally {
1954                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1955                    }
1956            }
1957    
1958            /**
1959             * Initializes the s c product version persistence.
1960             */
1961            public void afterPropertiesSet() {
1962                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1963                                            com.liferay.portal.util.PropsUtil.get(
1964                                                    "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductVersion")));
1965    
1966                    if (listenerClassNames.length > 0) {
1967                            try {
1968                                    List<ModelListener<SCProductVersion>> listenersList = new ArrayList<ModelListener<SCProductVersion>>();
1969    
1970                                    for (String listenerClassName : listenerClassNames) {
1971                                            listenersList.add((ModelListener<SCProductVersion>)InstanceFactory.newInstance(
1972                                                            getClassLoader(), listenerClassName));
1973                                    }
1974    
1975                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1976                            }
1977                            catch (Exception e) {
1978                                    _log.error(e);
1979                            }
1980                    }
1981    
1982                    containsSCFrameworkVersion = new ContainsSCFrameworkVersion();
1983    
1984                    addSCFrameworkVersion = new AddSCFrameworkVersion();
1985                    clearSCFrameworkVersions = new ClearSCFrameworkVersions();
1986                    removeSCFrameworkVersion = new RemoveSCFrameworkVersion();
1987            }
1988    
1989            public void destroy() {
1990                    EntityCacheUtil.removeCache(SCProductVersionImpl.class.getName());
1991                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1992                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1993                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1994            }
1995    
1996            @BeanReference(type = SCFrameworkVersionPersistence.class)
1997            protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
1998            protected ContainsSCFrameworkVersion containsSCFrameworkVersion;
1999            protected AddSCFrameworkVersion addSCFrameworkVersion;
2000            protected ClearSCFrameworkVersions clearSCFrameworkVersions;
2001            protected RemoveSCFrameworkVersion removeSCFrameworkVersion;
2002    
2003            protected class ContainsSCFrameworkVersion {
2004                    protected ContainsSCFrameworkVersion() {
2005                            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2006                                            "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?",
2007                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2008                                            RowMapper.COUNT);
2009                    }
2010    
2011                    protected boolean contains(long productVersionId,
2012                            long frameworkVersionId) {
2013                            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2014                                                    new Long(productVersionId), new Long(frameworkVersionId)
2015                                            });
2016    
2017                            if (results.size() > 0) {
2018                                    Integer count = results.get(0);
2019    
2020                                    if (count.intValue() > 0) {
2021                                            return true;
2022                                    }
2023                            }
2024    
2025                            return false;
2026                    }
2027    
2028                    private MappingSqlQuery<Integer> _mappingSqlQuery;
2029            }
2030    
2031            protected class AddSCFrameworkVersion {
2032                    protected AddSCFrameworkVersion() {
2033                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2034                                            "INSERT INTO SCFrameworkVersi_SCProductVers (productVersionId, frameworkVersionId) VALUES (?, ?)",
2035                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2036                    }
2037    
2038                    protected void add(long productVersionId, long frameworkVersionId)
2039                            throws SystemException {
2040                            if (!containsSCFrameworkVersion.contains(productVersionId,
2041                                                    frameworkVersionId)) {
2042                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2043                                            scFrameworkVersionPersistence.getListeners();
2044    
2045                                    for (ModelListener<SCProductVersion> listener : listeners) {
2046                                            listener.onBeforeAddAssociation(productVersionId,
2047                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2048                                                    frameworkVersionId);
2049                                    }
2050    
2051                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2052                                            listener.onBeforeAddAssociation(frameworkVersionId,
2053                                                    SCProductVersion.class.getName(), productVersionId);
2054                                    }
2055    
2056                                    _sqlUpdate.update(new Object[] {
2057                                                    new Long(productVersionId), new Long(frameworkVersionId)
2058                                            });
2059    
2060                                    for (ModelListener<SCProductVersion> listener : listeners) {
2061                                            listener.onAfterAddAssociation(productVersionId,
2062                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2063                                                    frameworkVersionId);
2064                                    }
2065    
2066                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2067                                            listener.onAfterAddAssociation(frameworkVersionId,
2068                                                    SCProductVersion.class.getName(), productVersionId);
2069                                    }
2070                            }
2071                    }
2072    
2073                    private SqlUpdate _sqlUpdate;
2074            }
2075    
2076            protected class ClearSCFrameworkVersions {
2077                    protected ClearSCFrameworkVersions() {
2078                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2079                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?",
2080                                            new int[] { java.sql.Types.BIGINT });
2081                    }
2082    
2083                    protected void clear(long productVersionId) throws SystemException {
2084                            ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2085                                    scFrameworkVersionPersistence.getListeners();
2086    
2087                            List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions =
2088                                    null;
2089    
2090                            if ((listeners.length > 0) ||
2091                                            (scFrameworkVersionListeners.length > 0)) {
2092                                    scFrameworkVersions = getSCFrameworkVersions(productVersionId);
2093    
2094                                    for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
2095                                            for (ModelListener<SCProductVersion> listener : listeners) {
2096                                                    listener.onBeforeRemoveAssociation(productVersionId,
2097                                                            com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2098                                                            scFrameworkVersion.getPrimaryKey());
2099                                            }
2100    
2101                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2102                                                    listener.onBeforeRemoveAssociation(scFrameworkVersion.getPrimaryKey(),
2103                                                            SCProductVersion.class.getName(), productVersionId);
2104                                            }
2105                                    }
2106                            }
2107    
2108                            _sqlUpdate.update(new Object[] { new Long(productVersionId) });
2109    
2110                            if ((listeners.length > 0) ||
2111                                            (scFrameworkVersionListeners.length > 0)) {
2112                                    for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
2113                                            for (ModelListener<SCProductVersion> listener : listeners) {
2114                                                    listener.onAfterRemoveAssociation(productVersionId,
2115                                                            com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2116                                                            scFrameworkVersion.getPrimaryKey());
2117                                            }
2118    
2119                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2120                                                    listener.onAfterRemoveAssociation(scFrameworkVersion.getPrimaryKey(),
2121                                                            SCProductVersion.class.getName(), productVersionId);
2122                                            }
2123                                    }
2124                            }
2125                    }
2126    
2127                    private SqlUpdate _sqlUpdate;
2128            }
2129    
2130            protected class RemoveSCFrameworkVersion {
2131                    protected RemoveSCFrameworkVersion() {
2132                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2133                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?",
2134                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2135                    }
2136    
2137                    protected void remove(long productVersionId, long frameworkVersionId)
2138                            throws SystemException {
2139                            if (containsSCFrameworkVersion.contains(productVersionId,
2140                                                    frameworkVersionId)) {
2141                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2142                                            scFrameworkVersionPersistence.getListeners();
2143    
2144                                    for (ModelListener<SCProductVersion> listener : listeners) {
2145                                            listener.onBeforeRemoveAssociation(productVersionId,
2146                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2147                                                    frameworkVersionId);
2148                                    }
2149    
2150                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2151                                            listener.onBeforeRemoveAssociation(frameworkVersionId,
2152                                                    SCProductVersion.class.getName(), productVersionId);
2153                                    }
2154    
2155                                    _sqlUpdate.update(new Object[] {
2156                                                    new Long(productVersionId), new Long(frameworkVersionId)
2157                                            });
2158    
2159                                    for (ModelListener<SCProductVersion> listener : listeners) {
2160                                            listener.onAfterRemoveAssociation(productVersionId,
2161                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2162                                                    frameworkVersionId);
2163                                    }
2164    
2165                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2166                                            listener.onAfterRemoveAssociation(frameworkVersionId,
2167                                                    SCProductVersion.class.getName(), productVersionId);
2168                                    }
2169                            }
2170                    }
2171    
2172                    private SqlUpdate _sqlUpdate;
2173            }
2174    
2175            private static final String _SQL_SELECT_SCPRODUCTVERSION = "SELECT scProductVersion FROM SCProductVersion scProductVersion";
2176            private static final String _SQL_SELECT_SCPRODUCTVERSION_WHERE = "SELECT scProductVersion FROM SCProductVersion scProductVersion WHERE ";
2177            private static final String _SQL_COUNT_SCPRODUCTVERSION = "SELECT COUNT(scProductVersion) FROM SCProductVersion scProductVersion";
2178            private static final String _SQL_COUNT_SCPRODUCTVERSION_WHERE = "SELECT COUNT(scProductVersion) FROM SCProductVersion scProductVersion WHERE ";
2179            private static final String _SQL_GETSCFRAMEWORKVERSIONS = "SELECT {SCFrameworkVersion.*} FROM SCFrameworkVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.frameworkVersionId = SCFrameworkVersion.frameworkVersionId) WHERE (SCFrameworkVersi_SCProductVers.productVersionId = ?)";
2180            private static final String _SQL_GETSCFRAMEWORKVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?";
2181            private static final String _ORDER_BY_ENTITY_ALIAS = "scProductVersion.";
2182            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductVersion exists with the primary key ";
2183            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductVersion exists with the key {";
2184            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2185            private static Log _log = LogFactoryUtil.getLog(SCProductVersionPersistenceImpl.class);
2186            private static SCProductVersion _nullSCProductVersion = new SCProductVersionImpl() {
2187                            @Override
2188                            public Object clone() {
2189                                    return this;
2190                            }
2191    
2192                            @Override
2193                            public CacheModel<SCProductVersion> toCacheModel() {
2194                                    return _nullSCProductVersionCacheModel;
2195                            }
2196                    };
2197    
2198            private static CacheModel<SCProductVersion> _nullSCProductVersionCacheModel = new CacheModel<SCProductVersion>() {
2199                            public SCProductVersion toEntityModel() {
2200                                    return _nullSCProductVersion;
2201                            }
2202                    };
2203    }