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