001    /**
002     * Copyright (c) 2000-present 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.portal.service.persistence.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.NoSuchPasswordTrackerException;
020    import com.liferay.portal.kernel.dao.orm.EntityCache;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCache;
023    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
024    import com.liferay.portal.kernel.dao.orm.FinderPath;
025    import com.liferay.portal.kernel.dao.orm.Query;
026    import com.liferay.portal.kernel.dao.orm.QueryPos;
027    import com.liferay.portal.kernel.dao.orm.QueryUtil;
028    import com.liferay.portal.kernel.dao.orm.Session;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.OrderByComparator;
032    import com.liferay.portal.kernel.util.SetUtil;
033    import com.liferay.portal.kernel.util.StringBundler;
034    import com.liferay.portal.kernel.util.StringPool;
035    import com.liferay.portal.model.CacheModel;
036    import com.liferay.portal.model.MVCCModel;
037    import com.liferay.portal.model.PasswordTracker;
038    import com.liferay.portal.model.impl.PasswordTrackerImpl;
039    import com.liferay.portal.model.impl.PasswordTrackerModelImpl;
040    import com.liferay.portal.service.persistence.PasswordTrackerPersistence;
041    
042    import java.io.Serializable;
043    
044    import java.util.Collections;
045    import java.util.HashMap;
046    import java.util.HashSet;
047    import java.util.Iterator;
048    import java.util.List;
049    import java.util.Map;
050    import java.util.Set;
051    
052    /**
053     * The persistence implementation for the password tracker service.
054     *
055     * <p>
056     * Caching information and settings can be found in <code>portal.properties</code>
057     * </p>
058     *
059     * @author Brian Wing Shun Chan
060     * @see PasswordTrackerPersistence
061     * @see com.liferay.portal.service.persistence.PasswordTrackerUtil
062     * @generated
063     */
064    @ProviderType
065    public class PasswordTrackerPersistenceImpl extends BasePersistenceImpl<PasswordTracker>
066            implements PasswordTrackerPersistence {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. Always use {@link PasswordTrackerUtil} to access the password tracker persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
071             */
072            public static final String FINDER_CLASS_NAME_ENTITY = PasswordTrackerImpl.class.getName();
073            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List1";
075            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076                    ".List2";
077            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
078                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
079                            PasswordTrackerImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
080                            "findAll", new String[0]);
081            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
082                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
083                            PasswordTrackerImpl.class,
084                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
085            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
086                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED, Long.class,
087                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
088            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
089                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
090                            PasswordTrackerImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
091                            "findByUserId",
092                            new String[] {
093                                    Long.class.getName(),
094                                    
095                            Integer.class.getName(), Integer.class.getName(),
096                                    OrderByComparator.class.getName()
097                            });
098            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
099                    new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
100                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED,
101                            PasswordTrackerImpl.class,
102                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
103                            new String[] { Long.class.getName() },
104                            PasswordTrackerModelImpl.USERID_COLUMN_BITMASK |
105                            PasswordTrackerModelImpl.CREATEDATE_COLUMN_BITMASK);
106            public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
107                            PasswordTrackerModelImpl.FINDER_CACHE_ENABLED, Long.class,
108                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
109                            new String[] { Long.class.getName() });
110    
111            /**
112             * Returns all the password trackers where userId = &#63;.
113             *
114             * @param userId the user ID
115             * @return the matching password trackers
116             */
117            @Override
118            public List<PasswordTracker> findByUserId(long userId) {
119                    return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
120            }
121    
122            /**
123             * Returns a range of all the password trackers where userId = &#63;.
124             *
125             * <p>
126             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
127             * </p>
128             *
129             * @param userId the user ID
130             * @param start the lower bound of the range of password trackers
131             * @param end the upper bound of the range of password trackers (not inclusive)
132             * @return the range of matching password trackers
133             */
134            @Override
135            public List<PasswordTracker> findByUserId(long userId, int start, int end) {
136                    return findByUserId(userId, start, end, null);
137            }
138    
139            /**
140             * Returns an ordered range of all the password trackers where userId = &#63;.
141             *
142             * <p>
143             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
144             * </p>
145             *
146             * @param userId the user ID
147             * @param start the lower bound of the range of password trackers
148             * @param end the upper bound of the range of password trackers (not inclusive)
149             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
150             * @return the ordered range of matching password trackers
151             */
152            @Override
153            public List<PasswordTracker> findByUserId(long userId, int start, int end,
154                    OrderByComparator<PasswordTracker> orderByComparator) {
155                    return findByUserId(userId, start, end, orderByComparator, true);
156            }
157    
158            /**
159             * Returns an ordered range of all the password trackers where userId = &#63;.
160             *
161             * <p>
162             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
163             * </p>
164             *
165             * @param userId the user ID
166             * @param start the lower bound of the range of password trackers
167             * @param end the upper bound of the range of password trackers (not inclusive)
168             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
169             * @param retrieveFromCache whether to retrieve from the finder cache
170             * @return the ordered range of matching password trackers
171             */
172            @Override
173            public List<PasswordTracker> findByUserId(long userId, int start, int end,
174                    OrderByComparator<PasswordTracker> orderByComparator,
175                    boolean retrieveFromCache) {
176                    boolean pagination = true;
177                    FinderPath finderPath = null;
178                    Object[] finderArgs = null;
179    
180                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
181                                    (orderByComparator == null)) {
182                            pagination = false;
183                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
184                            finderArgs = new Object[] { userId };
185                    }
186                    else {
187                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
188                            finderArgs = new Object[] { userId, start, end, orderByComparator };
189                    }
190    
191                    List<PasswordTracker> list = null;
192    
193                    if (retrieveFromCache) {
194                            list = (List<PasswordTracker>)finderCache.getResult(finderPath,
195                                            finderArgs, this);
196    
197                            if ((list != null) && !list.isEmpty()) {
198                                    for (PasswordTracker passwordTracker : list) {
199                                            if ((userId != passwordTracker.getUserId())) {
200                                                    list = null;
201    
202                                                    break;
203                                            }
204                                    }
205                            }
206                    }
207    
208                    if (list == null) {
209                            StringBundler query = null;
210    
211                            if (orderByComparator != null) {
212                                    query = new StringBundler(3 +
213                                                    (orderByComparator.getOrderByFields().length * 3));
214                            }
215                            else {
216                                    query = new StringBundler(3);
217                            }
218    
219                            query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
220    
221                            query.append(_FINDER_COLUMN_USERID_USERID_2);
222    
223                            if (orderByComparator != null) {
224                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
225                                            orderByComparator);
226                            }
227                            else
228                             if (pagination) {
229                                    query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
230                            }
231    
232                            String sql = query.toString();
233    
234                            Session session = null;
235    
236                            try {
237                                    session = openSession();
238    
239                                    Query q = session.createQuery(sql);
240    
241                                    QueryPos qPos = QueryPos.getInstance(q);
242    
243                                    qPos.add(userId);
244    
245                                    if (!pagination) {
246                                            list = (List<PasswordTracker>)QueryUtil.list(q,
247                                                            getDialect(), start, end, false);
248    
249                                            Collections.sort(list);
250    
251                                            list = Collections.unmodifiableList(list);
252                                    }
253                                    else {
254                                            list = (List<PasswordTracker>)QueryUtil.list(q,
255                                                            getDialect(), start, end);
256                                    }
257    
258                                    cacheResult(list);
259    
260                                    finderCache.putResult(finderPath, finderArgs, list);
261                            }
262                            catch (Exception e) {
263                                    finderCache.removeResult(finderPath, finderArgs);
264    
265                                    throw processException(e);
266                            }
267                            finally {
268                                    closeSession(session);
269                            }
270                    }
271    
272                    return list;
273            }
274    
275            /**
276             * Returns the first password tracker in the ordered set where userId = &#63;.
277             *
278             * @param userId the user ID
279             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
280             * @return the first matching password tracker
281             * @throws NoSuchPasswordTrackerException if a matching password tracker could not be found
282             */
283            @Override
284            public PasswordTracker findByUserId_First(long userId,
285                    OrderByComparator<PasswordTracker> orderByComparator)
286                    throws NoSuchPasswordTrackerException {
287                    PasswordTracker passwordTracker = fetchByUserId_First(userId,
288                                    orderByComparator);
289    
290                    if (passwordTracker != null) {
291                            return passwordTracker;
292                    }
293    
294                    StringBundler msg = new StringBundler(4);
295    
296                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
297    
298                    msg.append("userId=");
299                    msg.append(userId);
300    
301                    msg.append(StringPool.CLOSE_CURLY_BRACE);
302    
303                    throw new NoSuchPasswordTrackerException(msg.toString());
304            }
305    
306            /**
307             * Returns the first password tracker in the ordered set where userId = &#63;.
308             *
309             * @param userId the user ID
310             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
311             * @return the first matching password tracker, or <code>null</code> if a matching password tracker could not be found
312             */
313            @Override
314            public PasswordTracker fetchByUserId_First(long userId,
315                    OrderByComparator<PasswordTracker> orderByComparator) {
316                    List<PasswordTracker> list = findByUserId(userId, 0, 1,
317                                    orderByComparator);
318    
319                    if (!list.isEmpty()) {
320                            return list.get(0);
321                    }
322    
323                    return null;
324            }
325    
326            /**
327             * Returns the last password tracker in the ordered set where userId = &#63;.
328             *
329             * @param userId the user ID
330             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
331             * @return the last matching password tracker
332             * @throws NoSuchPasswordTrackerException if a matching password tracker could not be found
333             */
334            @Override
335            public PasswordTracker findByUserId_Last(long userId,
336                    OrderByComparator<PasswordTracker> orderByComparator)
337                    throws NoSuchPasswordTrackerException {
338                    PasswordTracker passwordTracker = fetchByUserId_Last(userId,
339                                    orderByComparator);
340    
341                    if (passwordTracker != null) {
342                            return passwordTracker;
343                    }
344    
345                    StringBundler msg = new StringBundler(4);
346    
347                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
348    
349                    msg.append("userId=");
350                    msg.append(userId);
351    
352                    msg.append(StringPool.CLOSE_CURLY_BRACE);
353    
354                    throw new NoSuchPasswordTrackerException(msg.toString());
355            }
356    
357            /**
358             * Returns the last password tracker in the ordered set where userId = &#63;.
359             *
360             * @param userId the user ID
361             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
362             * @return the last matching password tracker, or <code>null</code> if a matching password tracker could not be found
363             */
364            @Override
365            public PasswordTracker fetchByUserId_Last(long userId,
366                    OrderByComparator<PasswordTracker> orderByComparator) {
367                    int count = countByUserId(userId);
368    
369                    if (count == 0) {
370                            return null;
371                    }
372    
373                    List<PasswordTracker> list = findByUserId(userId, count - 1, count,
374                                    orderByComparator);
375    
376                    if (!list.isEmpty()) {
377                            return list.get(0);
378                    }
379    
380                    return null;
381            }
382    
383            /**
384             * Returns the password trackers before and after the current password tracker in the ordered set where userId = &#63;.
385             *
386             * @param passwordTrackerId the primary key of the current password tracker
387             * @param userId the user ID
388             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
389             * @return the previous, current, and next password tracker
390             * @throws NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
391             */
392            @Override
393            public PasswordTracker[] findByUserId_PrevAndNext(long passwordTrackerId,
394                    long userId, OrderByComparator<PasswordTracker> orderByComparator)
395                    throws NoSuchPasswordTrackerException {
396                    PasswordTracker passwordTracker = findByPrimaryKey(passwordTrackerId);
397    
398                    Session session = null;
399    
400                    try {
401                            session = openSession();
402    
403                            PasswordTracker[] array = new PasswordTrackerImpl[3];
404    
405                            array[0] = getByUserId_PrevAndNext(session, passwordTracker,
406                                            userId, orderByComparator, true);
407    
408                            array[1] = passwordTracker;
409    
410                            array[2] = getByUserId_PrevAndNext(session, passwordTracker,
411                                            userId, orderByComparator, false);
412    
413                            return array;
414                    }
415                    catch (Exception e) {
416                            throw processException(e);
417                    }
418                    finally {
419                            closeSession(session);
420                    }
421            }
422    
423            protected PasswordTracker getByUserId_PrevAndNext(Session session,
424                    PasswordTracker passwordTracker, long userId,
425                    OrderByComparator<PasswordTracker> orderByComparator, boolean previous) {
426                    StringBundler query = null;
427    
428                    if (orderByComparator != null) {
429                            query = new StringBundler(6 +
430                                            (orderByComparator.getOrderByFields().length * 6));
431                    }
432                    else {
433                            query = new StringBundler(3);
434                    }
435    
436                    query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE);
437    
438                    query.append(_FINDER_COLUMN_USERID_USERID_2);
439    
440                    if (orderByComparator != null) {
441                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
442    
443                            if (orderByConditionFields.length > 0) {
444                                    query.append(WHERE_AND);
445                            }
446    
447                            for (int i = 0; i < orderByConditionFields.length; i++) {
448                                    query.append(_ORDER_BY_ENTITY_ALIAS);
449                                    query.append(orderByConditionFields[i]);
450    
451                                    if ((i + 1) < orderByConditionFields.length) {
452                                            if (orderByComparator.isAscending() ^ previous) {
453                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
454                                            }
455                                            else {
456                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
457                                            }
458                                    }
459                                    else {
460                                            if (orderByComparator.isAscending() ^ previous) {
461                                                    query.append(WHERE_GREATER_THAN);
462                                            }
463                                            else {
464                                                    query.append(WHERE_LESSER_THAN);
465                                            }
466                                    }
467                            }
468    
469                            query.append(ORDER_BY_CLAUSE);
470    
471                            String[] orderByFields = orderByComparator.getOrderByFields();
472    
473                            for (int i = 0; i < orderByFields.length; i++) {
474                                    query.append(_ORDER_BY_ENTITY_ALIAS);
475                                    query.append(orderByFields[i]);
476    
477                                    if ((i + 1) < orderByFields.length) {
478                                            if (orderByComparator.isAscending() ^ previous) {
479                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
480                                            }
481                                            else {
482                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
483                                            }
484                                    }
485                                    else {
486                                            if (orderByComparator.isAscending() ^ previous) {
487                                                    query.append(ORDER_BY_ASC);
488                                            }
489                                            else {
490                                                    query.append(ORDER_BY_DESC);
491                                            }
492                                    }
493                            }
494                    }
495                    else {
496                            query.append(PasswordTrackerModelImpl.ORDER_BY_JPQL);
497                    }
498    
499                    String sql = query.toString();
500    
501                    Query q = session.createQuery(sql);
502    
503                    q.setFirstResult(0);
504                    q.setMaxResults(2);
505    
506                    QueryPos qPos = QueryPos.getInstance(q);
507    
508                    qPos.add(userId);
509    
510                    if (orderByComparator != null) {
511                            Object[] values = orderByComparator.getOrderByConditionValues(passwordTracker);
512    
513                            for (Object value : values) {
514                                    qPos.add(value);
515                            }
516                    }
517    
518                    List<PasswordTracker> list = q.list();
519    
520                    if (list.size() == 2) {
521                            return list.get(1);
522                    }
523                    else {
524                            return null;
525                    }
526            }
527    
528            /**
529             * Removes all the password trackers where userId = &#63; from the database.
530             *
531             * @param userId the user ID
532             */
533            @Override
534            public void removeByUserId(long userId) {
535                    for (PasswordTracker passwordTracker : findByUserId(userId,
536                                    QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
537                            remove(passwordTracker);
538                    }
539            }
540    
541            /**
542             * Returns the number of password trackers where userId = &#63;.
543             *
544             * @param userId the user ID
545             * @return the number of matching password trackers
546             */
547            @Override
548            public int countByUserId(long userId) {
549                    FinderPath finderPath = FINDER_PATH_COUNT_BY_USERID;
550    
551                    Object[] finderArgs = new Object[] { userId };
552    
553                    Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
554    
555                    if (count == null) {
556                            StringBundler query = new StringBundler(2);
557    
558                            query.append(_SQL_COUNT_PASSWORDTRACKER_WHERE);
559    
560                            query.append(_FINDER_COLUMN_USERID_USERID_2);
561    
562                            String sql = query.toString();
563    
564                            Session session = null;
565    
566                            try {
567                                    session = openSession();
568    
569                                    Query q = session.createQuery(sql);
570    
571                                    QueryPos qPos = QueryPos.getInstance(q);
572    
573                                    qPos.add(userId);
574    
575                                    count = (Long)q.uniqueResult();
576    
577                                    finderCache.putResult(finderPath, finderArgs, count);
578                            }
579                            catch (Exception e) {
580                                    finderCache.removeResult(finderPath, finderArgs);
581    
582                                    throw processException(e);
583                            }
584                            finally {
585                                    closeSession(session);
586                            }
587                    }
588    
589                    return count.intValue();
590            }
591    
592            private static final String _FINDER_COLUMN_USERID_USERID_2 = "passwordTracker.userId = ?";
593    
594            public PasswordTrackerPersistenceImpl() {
595                    setModelClass(PasswordTracker.class);
596            }
597    
598            /**
599             * Caches the password tracker in the entity cache if it is enabled.
600             *
601             * @param passwordTracker the password tracker
602             */
603            @Override
604            public void cacheResult(PasswordTracker passwordTracker) {
605                    entityCache.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
606                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
607                            passwordTracker);
608    
609                    passwordTracker.resetOriginalValues();
610            }
611    
612            /**
613             * Caches the password trackers in the entity cache if it is enabled.
614             *
615             * @param passwordTrackers the password trackers
616             */
617            @Override
618            public void cacheResult(List<PasswordTracker> passwordTrackers) {
619                    for (PasswordTracker passwordTracker : passwordTrackers) {
620                            if (entityCache.getResult(
621                                                    PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
622                                                    PasswordTrackerImpl.class,
623                                                    passwordTracker.getPrimaryKey()) == null) {
624                                    cacheResult(passwordTracker);
625                            }
626                            else {
627                                    passwordTracker.resetOriginalValues();
628                            }
629                    }
630            }
631    
632            /**
633             * Clears the cache for all password trackers.
634             *
635             * <p>
636             * The {@link EntityCache} and {@link FinderCache} are both cleared by this method.
637             * </p>
638             */
639            @Override
640            public void clearCache() {
641                    entityCache.clearCache(PasswordTrackerImpl.class);
642    
643                    finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
644                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
645                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
646            }
647    
648            /**
649             * Clears the cache for the password tracker.
650             *
651             * <p>
652             * The {@link EntityCache} and {@link FinderCache} are both cleared by this method.
653             * </p>
654             */
655            @Override
656            public void clearCache(PasswordTracker passwordTracker) {
657                    entityCache.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
658                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
659    
660                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
661                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
662            }
663    
664            @Override
665            public void clearCache(List<PasswordTracker> passwordTrackers) {
666                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
667                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
668    
669                    for (PasswordTracker passwordTracker : passwordTrackers) {
670                            entityCache.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
671                                    PasswordTrackerImpl.class, passwordTracker.getPrimaryKey());
672                    }
673            }
674    
675            /**
676             * Creates a new password tracker with the primary key. Does not add the password tracker to the database.
677             *
678             * @param passwordTrackerId the primary key for the new password tracker
679             * @return the new password tracker
680             */
681            @Override
682            public PasswordTracker create(long passwordTrackerId) {
683                    PasswordTracker passwordTracker = new PasswordTrackerImpl();
684    
685                    passwordTracker.setNew(true);
686                    passwordTracker.setPrimaryKey(passwordTrackerId);
687    
688                    return passwordTracker;
689            }
690    
691            /**
692             * Removes the password tracker with the primary key from the database. Also notifies the appropriate model listeners.
693             *
694             * @param passwordTrackerId the primary key of the password tracker
695             * @return the password tracker that was removed
696             * @throws NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
697             */
698            @Override
699            public PasswordTracker remove(long passwordTrackerId)
700                    throws NoSuchPasswordTrackerException {
701                    return remove((Serializable)passwordTrackerId);
702            }
703    
704            /**
705             * Removes the password tracker with the primary key from the database. Also notifies the appropriate model listeners.
706             *
707             * @param primaryKey the primary key of the password tracker
708             * @return the password tracker that was removed
709             * @throws NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
710             */
711            @Override
712            public PasswordTracker remove(Serializable primaryKey)
713                    throws NoSuchPasswordTrackerException {
714                    Session session = null;
715    
716                    try {
717                            session = openSession();
718    
719                            PasswordTracker passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
720                                            primaryKey);
721    
722                            if (passwordTracker == null) {
723                                    if (_log.isWarnEnabled()) {
724                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
725                                    }
726    
727                                    throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
728                                            primaryKey);
729                            }
730    
731                            return remove(passwordTracker);
732                    }
733                    catch (NoSuchPasswordTrackerException nsee) {
734                            throw nsee;
735                    }
736                    catch (Exception e) {
737                            throw processException(e);
738                    }
739                    finally {
740                            closeSession(session);
741                    }
742            }
743    
744            @Override
745            protected PasswordTracker removeImpl(PasswordTracker passwordTracker) {
746                    passwordTracker = toUnwrappedModel(passwordTracker);
747    
748                    Session session = null;
749    
750                    try {
751                            session = openSession();
752    
753                            if (!session.contains(passwordTracker)) {
754                                    passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
755                                                    passwordTracker.getPrimaryKeyObj());
756                            }
757    
758                            if (passwordTracker != null) {
759                                    session.delete(passwordTracker);
760                            }
761                    }
762                    catch (Exception e) {
763                            throw processException(e);
764                    }
765                    finally {
766                            closeSession(session);
767                    }
768    
769                    if (passwordTracker != null) {
770                            clearCache(passwordTracker);
771                    }
772    
773                    return passwordTracker;
774            }
775    
776            @Override
777            public PasswordTracker updateImpl(PasswordTracker passwordTracker) {
778                    passwordTracker = toUnwrappedModel(passwordTracker);
779    
780                    boolean isNew = passwordTracker.isNew();
781    
782                    PasswordTrackerModelImpl passwordTrackerModelImpl = (PasswordTrackerModelImpl)passwordTracker;
783    
784                    Session session = null;
785    
786                    try {
787                            session = openSession();
788    
789                            if (passwordTracker.isNew()) {
790                                    session.save(passwordTracker);
791    
792                                    passwordTracker.setNew(false);
793                            }
794                            else {
795                                    passwordTracker = (PasswordTracker)session.merge(passwordTracker);
796                            }
797                    }
798                    catch (Exception e) {
799                            throw processException(e);
800                    }
801                    finally {
802                            closeSession(session);
803                    }
804    
805                    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
806    
807                    if (isNew || !PasswordTrackerModelImpl.COLUMN_BITMASK_ENABLED) {
808                            finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
809                    }
810    
811                    else {
812                            if ((passwordTrackerModelImpl.getColumnBitmask() &
813                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
814                                    Object[] args = new Object[] {
815                                                    passwordTrackerModelImpl.getOriginalUserId()
816                                            };
817    
818                                    finderCache.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
819                                    finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
820                                            args);
821    
822                                    args = new Object[] { passwordTrackerModelImpl.getUserId() };
823    
824                                    finderCache.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
825                                    finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
826                                            args);
827                            }
828                    }
829    
830                    entityCache.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
831                            PasswordTrackerImpl.class, passwordTracker.getPrimaryKey(),
832                            passwordTracker, false);
833    
834                    passwordTracker.resetOriginalValues();
835    
836                    return passwordTracker;
837            }
838    
839            protected PasswordTracker toUnwrappedModel(PasswordTracker passwordTracker) {
840                    if (passwordTracker instanceof PasswordTrackerImpl) {
841                            return passwordTracker;
842                    }
843    
844                    PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();
845    
846                    passwordTrackerImpl.setNew(passwordTracker.isNew());
847                    passwordTrackerImpl.setPrimaryKey(passwordTracker.getPrimaryKey());
848    
849                    passwordTrackerImpl.setMvccVersion(passwordTracker.getMvccVersion());
850                    passwordTrackerImpl.setPasswordTrackerId(passwordTracker.getPasswordTrackerId());
851                    passwordTrackerImpl.setUserId(passwordTracker.getUserId());
852                    passwordTrackerImpl.setCreateDate(passwordTracker.getCreateDate());
853                    passwordTrackerImpl.setPassword(passwordTracker.getPassword());
854    
855                    return passwordTrackerImpl;
856            }
857    
858            /**
859             * Returns the password tracker with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
860             *
861             * @param primaryKey the primary key of the password tracker
862             * @return the password tracker
863             * @throws NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
864             */
865            @Override
866            public PasswordTracker findByPrimaryKey(Serializable primaryKey)
867                    throws NoSuchPasswordTrackerException {
868                    PasswordTracker passwordTracker = fetchByPrimaryKey(primaryKey);
869    
870                    if (passwordTracker == null) {
871                            if (_log.isWarnEnabled()) {
872                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
873                            }
874    
875                            throw new NoSuchPasswordTrackerException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
876                                    primaryKey);
877                    }
878    
879                    return passwordTracker;
880            }
881    
882            /**
883             * Returns the password tracker with the primary key or throws a {@link NoSuchPasswordTrackerException} if it could not be found.
884             *
885             * @param passwordTrackerId the primary key of the password tracker
886             * @return the password tracker
887             * @throws NoSuchPasswordTrackerException if a password tracker with the primary key could not be found
888             */
889            @Override
890            public PasswordTracker findByPrimaryKey(long passwordTrackerId)
891                    throws NoSuchPasswordTrackerException {
892                    return findByPrimaryKey((Serializable)passwordTrackerId);
893            }
894    
895            /**
896             * Returns the password tracker with the primary key or returns <code>null</code> if it could not be found.
897             *
898             * @param primaryKey the primary key of the password tracker
899             * @return the password tracker, or <code>null</code> if a password tracker with the primary key could not be found
900             */
901            @Override
902            public PasswordTracker fetchByPrimaryKey(Serializable primaryKey) {
903                    PasswordTracker passwordTracker = (PasswordTracker)entityCache.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
904                                    PasswordTrackerImpl.class, primaryKey);
905    
906                    if (passwordTracker == _nullPasswordTracker) {
907                            return null;
908                    }
909    
910                    if (passwordTracker == null) {
911                            Session session = null;
912    
913                            try {
914                                    session = openSession();
915    
916                                    passwordTracker = (PasswordTracker)session.get(PasswordTrackerImpl.class,
917                                                    primaryKey);
918    
919                                    if (passwordTracker != null) {
920                                            cacheResult(passwordTracker);
921                                    }
922                                    else {
923                                            entityCache.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
924                                                    PasswordTrackerImpl.class, primaryKey,
925                                                    _nullPasswordTracker);
926                                    }
927                            }
928                            catch (Exception e) {
929                                    entityCache.removeResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
930                                            PasswordTrackerImpl.class, primaryKey);
931    
932                                    throw processException(e);
933                            }
934                            finally {
935                                    closeSession(session);
936                            }
937                    }
938    
939                    return passwordTracker;
940            }
941    
942            /**
943             * Returns the password tracker with the primary key or returns <code>null</code> if it could not be found.
944             *
945             * @param passwordTrackerId the primary key of the password tracker
946             * @return the password tracker, or <code>null</code> if a password tracker with the primary key could not be found
947             */
948            @Override
949            public PasswordTracker fetchByPrimaryKey(long passwordTrackerId) {
950                    return fetchByPrimaryKey((Serializable)passwordTrackerId);
951            }
952    
953            @Override
954            public Map<Serializable, PasswordTracker> fetchByPrimaryKeys(
955                    Set<Serializable> primaryKeys) {
956                    if (primaryKeys.isEmpty()) {
957                            return Collections.emptyMap();
958                    }
959    
960                    Map<Serializable, PasswordTracker> map = new HashMap<Serializable, PasswordTracker>();
961    
962                    if (primaryKeys.size() == 1) {
963                            Iterator<Serializable> iterator = primaryKeys.iterator();
964    
965                            Serializable primaryKey = iterator.next();
966    
967                            PasswordTracker passwordTracker = fetchByPrimaryKey(primaryKey);
968    
969                            if (passwordTracker != null) {
970                                    map.put(primaryKey, passwordTracker);
971                            }
972    
973                            return map;
974                    }
975    
976                    Set<Serializable> uncachedPrimaryKeys = null;
977    
978                    for (Serializable primaryKey : primaryKeys) {
979                            PasswordTracker passwordTracker = (PasswordTracker)entityCache.getResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
980                                            PasswordTrackerImpl.class, primaryKey);
981    
982                            if (passwordTracker == null) {
983                                    if (uncachedPrimaryKeys == null) {
984                                            uncachedPrimaryKeys = new HashSet<Serializable>();
985                                    }
986    
987                                    uncachedPrimaryKeys.add(primaryKey);
988                            }
989                            else {
990                                    map.put(primaryKey, passwordTracker);
991                            }
992                    }
993    
994                    if (uncachedPrimaryKeys == null) {
995                            return map;
996                    }
997    
998                    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
999                                    1);
1000    
1001                    query.append(_SQL_SELECT_PASSWORDTRACKER_WHERE_PKS_IN);
1002    
1003                    for (Serializable primaryKey : uncachedPrimaryKeys) {
1004                            query.append(String.valueOf(primaryKey));
1005    
1006                            query.append(StringPool.COMMA);
1007                    }
1008    
1009                    query.setIndex(query.index() - 1);
1010    
1011                    query.append(StringPool.CLOSE_PARENTHESIS);
1012    
1013                    String sql = query.toString();
1014    
1015                    Session session = null;
1016    
1017                    try {
1018                            session = openSession();
1019    
1020                            Query q = session.createQuery(sql);
1021    
1022                            for (PasswordTracker passwordTracker : (List<PasswordTracker>)q.list()) {
1023                                    map.put(passwordTracker.getPrimaryKeyObj(), passwordTracker);
1024    
1025                                    cacheResult(passwordTracker);
1026    
1027                                    uncachedPrimaryKeys.remove(passwordTracker.getPrimaryKeyObj());
1028                            }
1029    
1030                            for (Serializable primaryKey : uncachedPrimaryKeys) {
1031                                    entityCache.putResult(PasswordTrackerModelImpl.ENTITY_CACHE_ENABLED,
1032                                            PasswordTrackerImpl.class, primaryKey, _nullPasswordTracker);
1033                            }
1034                    }
1035                    catch (Exception e) {
1036                            throw processException(e);
1037                    }
1038                    finally {
1039                            closeSession(session);
1040                    }
1041    
1042                    return map;
1043            }
1044    
1045            /**
1046             * Returns all the password trackers.
1047             *
1048             * @return the password trackers
1049             */
1050            @Override
1051            public List<PasswordTracker> findAll() {
1052                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1053            }
1054    
1055            /**
1056             * Returns a range of all the password trackers.
1057             *
1058             * <p>
1059             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
1060             * </p>
1061             *
1062             * @param start the lower bound of the range of password trackers
1063             * @param end the upper bound of the range of password trackers (not inclusive)
1064             * @return the range of password trackers
1065             */
1066            @Override
1067            public List<PasswordTracker> findAll(int start, int end) {
1068                    return findAll(start, end, null);
1069            }
1070    
1071            /**
1072             * Returns an ordered range of all the password trackers.
1073             *
1074             * <p>
1075             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
1076             * </p>
1077             *
1078             * @param start the lower bound of the range of password trackers
1079             * @param end the upper bound of the range of password trackers (not inclusive)
1080             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1081             * @return the ordered range of password trackers
1082             */
1083            @Override
1084            public List<PasswordTracker> findAll(int start, int end,
1085                    OrderByComparator<PasswordTracker> orderByComparator) {
1086                    return findAll(start, end, orderByComparator, true);
1087            }
1088    
1089            /**
1090             * Returns an ordered range of all the password trackers.
1091             *
1092             * <p>
1093             * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link PasswordTrackerModelImpl}. 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.
1094             * </p>
1095             *
1096             * @param start the lower bound of the range of password trackers
1097             * @param end the upper bound of the range of password trackers (not inclusive)
1098             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1099             * @param retrieveFromCache whether to retrieve from the finder cache
1100             * @return the ordered range of password trackers
1101             */
1102            @Override
1103            public List<PasswordTracker> findAll(int start, int end,
1104                    OrderByComparator<PasswordTracker> orderByComparator,
1105                    boolean retrieveFromCache) {
1106                    boolean pagination = true;
1107                    FinderPath finderPath = null;
1108                    Object[] finderArgs = null;
1109    
1110                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1111                                    (orderByComparator == null)) {
1112                            pagination = false;
1113                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1114                            finderArgs = FINDER_ARGS_EMPTY;
1115                    }
1116                    else {
1117                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1118                            finderArgs = new Object[] { start, end, orderByComparator };
1119                    }
1120    
1121                    List<PasswordTracker> list = null;
1122    
1123                    if (retrieveFromCache) {
1124                            list = (List<PasswordTracker>)finderCache.getResult(finderPath,
1125                                            finderArgs, this);
1126                    }
1127    
1128                    if (list == null) {
1129                            StringBundler query = null;
1130                            String sql = null;
1131    
1132                            if (orderByComparator != null) {
1133                                    query = new StringBundler(2 +
1134                                                    (orderByComparator.getOrderByFields().length * 3));
1135    
1136                                    query.append(_SQL_SELECT_PASSWORDTRACKER);
1137    
1138                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1139                                            orderByComparator);
1140    
1141                                    sql = query.toString();
1142                            }
1143                            else {
1144                                    sql = _SQL_SELECT_PASSWORDTRACKER;
1145    
1146                                    if (pagination) {
1147                                            sql = sql.concat(PasswordTrackerModelImpl.ORDER_BY_JPQL);
1148                                    }
1149                            }
1150    
1151                            Session session = null;
1152    
1153                            try {
1154                                    session = openSession();
1155    
1156                                    Query q = session.createQuery(sql);
1157    
1158                                    if (!pagination) {
1159                                            list = (List<PasswordTracker>)QueryUtil.list(q,
1160                                                            getDialect(), start, end, false);
1161    
1162                                            Collections.sort(list);
1163    
1164                                            list = Collections.unmodifiableList(list);
1165                                    }
1166                                    else {
1167                                            list = (List<PasswordTracker>)QueryUtil.list(q,
1168                                                            getDialect(), start, end);
1169                                    }
1170    
1171                                    cacheResult(list);
1172    
1173                                    finderCache.putResult(finderPath, finderArgs, list);
1174                            }
1175                            catch (Exception e) {
1176                                    finderCache.removeResult(finderPath, finderArgs);
1177    
1178                                    throw processException(e);
1179                            }
1180                            finally {
1181                                    closeSession(session);
1182                            }
1183                    }
1184    
1185                    return list;
1186            }
1187    
1188            /**
1189             * Removes all the password trackers from the database.
1190             *
1191             */
1192            @Override
1193            public void removeAll() {
1194                    for (PasswordTracker passwordTracker : findAll()) {
1195                            remove(passwordTracker);
1196                    }
1197            }
1198    
1199            /**
1200             * Returns the number of password trackers.
1201             *
1202             * @return the number of password trackers
1203             */
1204            @Override
1205            public int countAll() {
1206                    Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
1207                                    FINDER_ARGS_EMPTY, this);
1208    
1209                    if (count == null) {
1210                            Session session = null;
1211    
1212                            try {
1213                                    session = openSession();
1214    
1215                                    Query q = session.createQuery(_SQL_COUNT_PASSWORDTRACKER);
1216    
1217                                    count = (Long)q.uniqueResult();
1218    
1219                                    finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
1220                                            count);
1221                            }
1222                            catch (Exception e) {
1223                                    finderCache.removeResult(FINDER_PATH_COUNT_ALL,
1224                                            FINDER_ARGS_EMPTY);
1225    
1226                                    throw processException(e);
1227                            }
1228                            finally {
1229                                    closeSession(session);
1230                            }
1231                    }
1232    
1233                    return count.intValue();
1234            }
1235    
1236            @Override
1237            public Set<String> getBadColumnNames() {
1238                    return _badColumnNames;
1239            }
1240    
1241            @Override
1242            protected Map<String, Integer> getTableColumnsMap() {
1243                    return PasswordTrackerModelImpl.TABLE_COLUMNS_MAP;
1244            }
1245    
1246            /**
1247             * Initializes the password tracker persistence.
1248             */
1249            public void afterPropertiesSet() {
1250            }
1251    
1252            public void destroy() {
1253                    entityCache.removeCache(PasswordTrackerImpl.class.getName());
1254                    finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
1255                    finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1256                    finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1257            }
1258    
1259            protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
1260            protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
1261            private static final String _SQL_SELECT_PASSWORDTRACKER = "SELECT passwordTracker FROM PasswordTracker passwordTracker";
1262            private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE_PKS_IN = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE passwordTrackerId IN (";
1263            private static final String _SQL_SELECT_PASSWORDTRACKER_WHERE = "SELECT passwordTracker FROM PasswordTracker passwordTracker WHERE ";
1264            private static final String _SQL_COUNT_PASSWORDTRACKER = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker";
1265            private static final String _SQL_COUNT_PASSWORDTRACKER_WHERE = "SELECT COUNT(passwordTracker) FROM PasswordTracker passwordTracker WHERE ";
1266            private static final String _ORDER_BY_ENTITY_ALIAS = "passwordTracker.";
1267            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordTracker exists with the primary key ";
1268            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordTracker exists with the key {";
1269            private static final Log _log = LogFactoryUtil.getLog(PasswordTrackerPersistenceImpl.class);
1270            private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
1271                                    "password"
1272                            });
1273            private static final PasswordTracker _nullPasswordTracker = new PasswordTrackerImpl() {
1274                            @Override
1275                            public Object clone() {
1276                                    return this;
1277                            }
1278    
1279                            @Override
1280                            public CacheModel<PasswordTracker> toCacheModel() {
1281                                    return _nullPasswordTrackerCacheModel;
1282                            }
1283                    };
1284    
1285            private static final CacheModel<PasswordTracker> _nullPasswordTrackerCacheModel =
1286                    new NullCacheModel();
1287    
1288            private static class NullCacheModel implements CacheModel<PasswordTracker>,
1289                    MVCCModel {
1290                    @Override
1291                    public long getMvccVersion() {
1292                            return -1;
1293                    }
1294    
1295                    @Override
1296                    public void setMvccVersion(long mvccVersion) {
1297                    }
1298    
1299                    @Override
1300                    public PasswordTracker toEntityModel() {
1301                            return _nullPasswordTracker;
1302                    }
1303            }
1304    }