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