1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.expando.service.persistence;
24  
25  import com.liferay.portal.NoSuchModelException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.annotation.BeanReference;
28  import com.liferay.portal.kernel.cache.CacheRegistry;
29  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
30  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderPath;
33  import com.liferay.portal.kernel.dao.orm.Query;
34  import com.liferay.portal.kernel.dao.orm.QueryPos;
35  import com.liferay.portal.kernel.dao.orm.QueryUtil;
36  import com.liferay.portal.kernel.dao.orm.Session;
37  import com.liferay.portal.kernel.log.Log;
38  import com.liferay.portal.kernel.log.LogFactoryUtil;
39  import com.liferay.portal.kernel.util.GetterUtil;
40  import com.liferay.portal.kernel.util.OrderByComparator;
41  import com.liferay.portal.kernel.util.StringBundler;
42  import com.liferay.portal.kernel.util.StringPool;
43  import com.liferay.portal.kernel.util.StringUtil;
44  import com.liferay.portal.model.ModelListener;
45  import com.liferay.portal.service.persistence.BatchSessionUtil;
46  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47  
48  import com.liferay.portlet.expando.NoSuchValueException;
49  import com.liferay.portlet.expando.model.ExpandoValue;
50  import com.liferay.portlet.expando.model.impl.ExpandoValueImpl;
51  import com.liferay.portlet.expando.model.impl.ExpandoValueModelImpl;
52  
53  import java.io.Serializable;
54  
55  import java.util.ArrayList;
56  import java.util.Collections;
57  import java.util.List;
58  
59  /**
60   * <a href="ExpandoValuePersistenceImpl.java.html"><b><i>View Source</i></b></a>
61   *
62   * <p>
63   * ServiceBuilder generated this class. Modifications in this class will be
64   * overwritten the next time is generated.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       ExpandoValuePersistence
69   * @see       ExpandoValueUtil
70   * @generated
71   */
72  public class ExpandoValuePersistenceImpl extends BasePersistenceImpl<ExpandoValue>
73      implements ExpandoValuePersistence {
74      public static final String FINDER_CLASS_NAME_ENTITY = ExpandoValueImpl.class.getName();
75      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
76          ".List";
77      public static final FinderPath FINDER_PATH_FIND_BY_TABLEID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
78              ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
79              "findByTableId", new String[] { Long.class.getName() });
80      public static final FinderPath FINDER_PATH_FIND_BY_OBC_TABLEID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
81              ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82              "findByTableId",
83              new String[] {
84                  Long.class.getName(),
85                  
86              "java.lang.Integer", "java.lang.Integer",
87                  "com.liferay.portal.kernel.util.OrderByComparator"
88              });
89      public static final FinderPath FINDER_PATH_COUNT_BY_TABLEID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
90              ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
91              "countByTableId", new String[] { Long.class.getName() });
92      public static final FinderPath FINDER_PATH_FIND_BY_COLUMNID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
93              ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
94              "findByColumnId", new String[] { Long.class.getName() });
95      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COLUMNID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
96              ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
97              "findByColumnId",
98              new String[] {
99                  Long.class.getName(),
100                 
101             "java.lang.Integer", "java.lang.Integer",
102                 "com.liferay.portal.kernel.util.OrderByComparator"
103             });
104     public static final FinderPath FINDER_PATH_COUNT_BY_COLUMNID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
105             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106             "countByColumnId", new String[] { Long.class.getName() });
107     public static final FinderPath FINDER_PATH_FIND_BY_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
108             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109             "findByRowId", new String[] { Long.class.getName() });
110     public static final FinderPath FINDER_PATH_FIND_BY_OBC_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
111             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112             "findByRowId",
113             new String[] {
114                 Long.class.getName(),
115                 
116             "java.lang.Integer", "java.lang.Integer",
117                 "com.liferay.portal.kernel.util.OrderByComparator"
118             });
119     public static final FinderPath FINDER_PATH_COUNT_BY_ROWID = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
120             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
121             "countByRowId", new String[] { Long.class.getName() });
122     public static final FinderPath FINDER_PATH_FIND_BY_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
123             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
124             "findByT_C",
125             new String[] { Long.class.getName(), Long.class.getName() });
126     public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
127             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
128             "findByT_C",
129             new String[] {
130                 Long.class.getName(), Long.class.getName(),
131                 
132             "java.lang.Integer", "java.lang.Integer",
133                 "com.liferay.portal.kernel.util.OrderByComparator"
134             });
135     public static final FinderPath FINDER_PATH_COUNT_BY_T_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
136             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
137             "countByT_C",
138             new String[] { Long.class.getName(), Long.class.getName() });
139     public static final FinderPath FINDER_PATH_FIND_BY_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
140             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
141             "findByT_CPK",
142             new String[] { Long.class.getName(), Long.class.getName() });
143     public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
144             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
145             "findByT_CPK",
146             new String[] {
147                 Long.class.getName(), Long.class.getName(),
148                 
149             "java.lang.Integer", "java.lang.Integer",
150                 "com.liferay.portal.kernel.util.OrderByComparator"
151             });
152     public static final FinderPath FINDER_PATH_COUNT_BY_T_CPK = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
153             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
154             "countByT_CPK",
155             new String[] { Long.class.getName(), Long.class.getName() });
156     public static final FinderPath FINDER_PATH_FIND_BY_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
157             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
158             "findByT_R",
159             new String[] { Long.class.getName(), Long.class.getName() });
160     public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
161             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
162             "findByT_R",
163             new String[] {
164                 Long.class.getName(), Long.class.getName(),
165                 
166             "java.lang.Integer", "java.lang.Integer",
167                 "com.liferay.portal.kernel.util.OrderByComparator"
168             });
169     public static final FinderPath FINDER_PATH_COUNT_BY_T_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
170             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
171             "countByT_R",
172             new String[] { Long.class.getName(), Long.class.getName() });
173     public static final FinderPath FINDER_PATH_FETCH_BY_C_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
174             ExpandoValueModelImpl.FINDER_CACHE_ENABLED,
175             FINDER_CLASS_NAME_ENTITY, "fetchByC_R",
176             new String[] { Long.class.getName(), Long.class.getName() });
177     public static final FinderPath FINDER_PATH_COUNT_BY_C_R = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
178             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
179             "countByC_R",
180             new String[] { Long.class.getName(), Long.class.getName() });
181     public static final FinderPath FINDER_PATH_FIND_BY_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
182             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
183             "findByC_C",
184             new String[] { Long.class.getName(), Long.class.getName() });
185     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
186             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
187             "findByC_C",
188             new String[] {
189                 Long.class.getName(), Long.class.getName(),
190                 
191             "java.lang.Integer", "java.lang.Integer",
192                 "com.liferay.portal.kernel.util.OrderByComparator"
193             });
194     public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
195             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
196             "countByC_C",
197             new String[] { Long.class.getName(), Long.class.getName() });
198     public static final FinderPath FINDER_PATH_FETCH_BY_T_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
199             ExpandoValueModelImpl.FINDER_CACHE_ENABLED,
200             FINDER_CLASS_NAME_ENTITY, "fetchByT_C_C",
201             new String[] {
202                 Long.class.getName(), Long.class.getName(), Long.class.getName()
203             });
204     public static final FinderPath FINDER_PATH_COUNT_BY_T_C_C = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
205             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
206             "countByT_C_C",
207             new String[] {
208                 Long.class.getName(), Long.class.getName(), Long.class.getName()
209             });
210     public static final FinderPath FINDER_PATH_FIND_BY_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
211             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
212             "findByT_C_D",
213             new String[] {
214                 Long.class.getName(), Long.class.getName(),
215                 String.class.getName()
216             });
217     public static final FinderPath FINDER_PATH_FIND_BY_OBC_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
218             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
219             "findByT_C_D",
220             new String[] {
221                 Long.class.getName(), Long.class.getName(),
222                 String.class.getName(),
223                 
224             "java.lang.Integer", "java.lang.Integer",
225                 "com.liferay.portal.kernel.util.OrderByComparator"
226             });
227     public static final FinderPath FINDER_PATH_COUNT_BY_T_C_D = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
228             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
229             "countByT_C_D",
230             new String[] {
231                 Long.class.getName(), Long.class.getName(),
232                 String.class.getName()
233             });
234     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
235             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
236             "findAll", new String[0]);
237     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
238             ExpandoValueModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
239             "countAll", new String[0]);
240 
241     public void cacheResult(ExpandoValue expandoValue) {
242         EntityCacheUtil.putResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
243             ExpandoValueImpl.class, expandoValue.getPrimaryKey(), expandoValue);
244 
245         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
246             new Object[] {
247                 new Long(expandoValue.getColumnId()),
248                 new Long(expandoValue.getRowId())
249             }, expandoValue);
250 
251         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
252             new Object[] {
253                 new Long(expandoValue.getTableId()),
254                 new Long(expandoValue.getColumnId()),
255                 new Long(expandoValue.getClassPK())
256             }, expandoValue);
257     }
258 
259     public void cacheResult(List<ExpandoValue> expandoValues) {
260         for (ExpandoValue expandoValue : expandoValues) {
261             if (EntityCacheUtil.getResult(
262                         ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
263                         ExpandoValueImpl.class, expandoValue.getPrimaryKey(),
264                         this) == null) {
265                 cacheResult(expandoValue);
266             }
267         }
268     }
269 
270     public void clearCache() {
271         CacheRegistry.clear(ExpandoValueImpl.class.getName());
272         EntityCacheUtil.clearCache(ExpandoValueImpl.class.getName());
273         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
274         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
275     }
276 
277     public ExpandoValue create(long valueId) {
278         ExpandoValue expandoValue = new ExpandoValueImpl();
279 
280         expandoValue.setNew(true);
281         expandoValue.setPrimaryKey(valueId);
282 
283         return expandoValue;
284     }
285 
286     public ExpandoValue remove(Serializable primaryKey)
287         throws NoSuchModelException, SystemException {
288         return remove(((Long)primaryKey).longValue());
289     }
290 
291     public ExpandoValue remove(long valueId)
292         throws NoSuchValueException, SystemException {
293         Session session = null;
294 
295         try {
296             session = openSession();
297 
298             ExpandoValue expandoValue = (ExpandoValue)session.get(ExpandoValueImpl.class,
299                     new Long(valueId));
300 
301             if (expandoValue == null) {
302                 if (_log.isWarnEnabled()) {
303                     _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + valueId);
304                 }
305 
306                 throw new NoSuchValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
307                     valueId);
308             }
309 
310             return remove(expandoValue);
311         }
312         catch (NoSuchValueException nsee) {
313             throw nsee;
314         }
315         catch (Exception e) {
316             throw processException(e);
317         }
318         finally {
319             closeSession(session);
320         }
321     }
322 
323     public ExpandoValue remove(ExpandoValue expandoValue)
324         throws SystemException {
325         for (ModelListener<ExpandoValue> listener : listeners) {
326             listener.onBeforeRemove(expandoValue);
327         }
328 
329         expandoValue = removeImpl(expandoValue);
330 
331         for (ModelListener<ExpandoValue> listener : listeners) {
332             listener.onAfterRemove(expandoValue);
333         }
334 
335         return expandoValue;
336     }
337 
338     protected ExpandoValue removeImpl(ExpandoValue expandoValue)
339         throws SystemException {
340         expandoValue = toUnwrappedModel(expandoValue);
341 
342         Session session = null;
343 
344         try {
345             session = openSession();
346 
347             if (expandoValue.isCachedModel() || BatchSessionUtil.isEnabled()) {
348                 Object staleObject = session.get(ExpandoValueImpl.class,
349                         expandoValue.getPrimaryKeyObj());
350 
351                 if (staleObject != null) {
352                     session.evict(staleObject);
353                 }
354             }
355 
356             session.delete(expandoValue);
357 
358             session.flush();
359         }
360         catch (Exception e) {
361             throw processException(e);
362         }
363         finally {
364             closeSession(session);
365         }
366 
367         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
368 
369         ExpandoValueModelImpl expandoValueModelImpl = (ExpandoValueModelImpl)expandoValue;
370 
371         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R,
372             new Object[] {
373                 new Long(expandoValueModelImpl.getOriginalColumnId()),
374                 new Long(expandoValueModelImpl.getOriginalRowId())
375             });
376 
377         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C,
378             new Object[] {
379                 new Long(expandoValueModelImpl.getOriginalTableId()),
380                 new Long(expandoValueModelImpl.getOriginalColumnId()),
381                 new Long(expandoValueModelImpl.getOriginalClassPK())
382             });
383 
384         EntityCacheUtil.removeResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
385             ExpandoValueImpl.class, expandoValue.getPrimaryKey());
386 
387         return expandoValue;
388     }
389 
390     /**
391      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
392      */
393     public ExpandoValue update(ExpandoValue expandoValue)
394         throws SystemException {
395         if (_log.isWarnEnabled()) {
396             _log.warn(
397                 "Using the deprecated update(ExpandoValue expandoValue) method. Use update(ExpandoValue expandoValue, boolean merge) instead.");
398         }
399 
400         return update(expandoValue, false);
401     }
402 
403     public ExpandoValue updateImpl(
404         com.liferay.portlet.expando.model.ExpandoValue expandoValue,
405         boolean merge) throws SystemException {
406         expandoValue = toUnwrappedModel(expandoValue);
407 
408         boolean isNew = expandoValue.isNew();
409 
410         ExpandoValueModelImpl expandoValueModelImpl = (ExpandoValueModelImpl)expandoValue;
411 
412         Session session = null;
413 
414         try {
415             session = openSession();
416 
417             BatchSessionUtil.update(session, expandoValue, merge);
418 
419             expandoValue.setNew(false);
420         }
421         catch (Exception e) {
422             throw processException(e);
423         }
424         finally {
425             closeSession(session);
426         }
427 
428         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
429 
430         EntityCacheUtil.putResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
431             ExpandoValueImpl.class, expandoValue.getPrimaryKey(), expandoValue);
432 
433         if (!isNew &&
434                 ((expandoValue.getColumnId() != expandoValueModelImpl.getOriginalColumnId()) ||
435                 (expandoValue.getRowId() != expandoValueModelImpl.getOriginalRowId()))) {
436             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_R,
437                 new Object[] {
438                     new Long(expandoValueModelImpl.getOriginalColumnId()),
439                     new Long(expandoValueModelImpl.getOriginalRowId())
440                 });
441         }
442 
443         if (isNew ||
444                 ((expandoValue.getColumnId() != expandoValueModelImpl.getOriginalColumnId()) ||
445                 (expandoValue.getRowId() != expandoValueModelImpl.getOriginalRowId()))) {
446             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
447                 new Object[] {
448                     new Long(expandoValue.getColumnId()),
449                     new Long(expandoValue.getRowId())
450                 }, expandoValue);
451         }
452 
453         if (!isNew &&
454                 ((expandoValue.getTableId() != expandoValueModelImpl.getOriginalTableId()) ||
455                 (expandoValue.getColumnId() != expandoValueModelImpl.getOriginalColumnId()) ||
456                 (expandoValue.getClassPK() != expandoValueModelImpl.getOriginalClassPK()))) {
457             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_T_C_C,
458                 new Object[] {
459                     new Long(expandoValueModelImpl.getOriginalTableId()),
460                     new Long(expandoValueModelImpl.getOriginalColumnId()),
461                     new Long(expandoValueModelImpl.getOriginalClassPK())
462                 });
463         }
464 
465         if (isNew ||
466                 ((expandoValue.getTableId() != expandoValueModelImpl.getOriginalTableId()) ||
467                 (expandoValue.getColumnId() != expandoValueModelImpl.getOriginalColumnId()) ||
468                 (expandoValue.getClassPK() != expandoValueModelImpl.getOriginalClassPK()))) {
469             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
470                 new Object[] {
471                     new Long(expandoValue.getTableId()),
472                     new Long(expandoValue.getColumnId()),
473                     new Long(expandoValue.getClassPK())
474                 }, expandoValue);
475         }
476 
477         return expandoValue;
478     }
479 
480     protected ExpandoValue toUnwrappedModel(ExpandoValue expandoValue) {
481         if (expandoValue instanceof ExpandoValueImpl) {
482             return expandoValue;
483         }
484 
485         ExpandoValueImpl expandoValueImpl = new ExpandoValueImpl();
486 
487         expandoValueImpl.setNew(expandoValue.isNew());
488         expandoValueImpl.setPrimaryKey(expandoValue.getPrimaryKey());
489 
490         expandoValueImpl.setValueId(expandoValue.getValueId());
491         expandoValueImpl.setCompanyId(expandoValue.getCompanyId());
492         expandoValueImpl.setTableId(expandoValue.getTableId());
493         expandoValueImpl.setColumnId(expandoValue.getColumnId());
494         expandoValueImpl.setRowId(expandoValue.getRowId());
495         expandoValueImpl.setClassNameId(expandoValue.getClassNameId());
496         expandoValueImpl.setClassPK(expandoValue.getClassPK());
497         expandoValueImpl.setData(expandoValue.getData());
498 
499         return expandoValueImpl;
500     }
501 
502     public ExpandoValue findByPrimaryKey(Serializable primaryKey)
503         throws NoSuchModelException, SystemException {
504         return findByPrimaryKey(((Long)primaryKey).longValue());
505     }
506 
507     public ExpandoValue findByPrimaryKey(long valueId)
508         throws NoSuchValueException, SystemException {
509         ExpandoValue expandoValue = fetchByPrimaryKey(valueId);
510 
511         if (expandoValue == null) {
512             if (_log.isWarnEnabled()) {
513                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + valueId);
514             }
515 
516             throw new NoSuchValueException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
517                 valueId);
518         }
519 
520         return expandoValue;
521     }
522 
523     public ExpandoValue fetchByPrimaryKey(Serializable primaryKey)
524         throws SystemException {
525         return fetchByPrimaryKey(((Long)primaryKey).longValue());
526     }
527 
528     public ExpandoValue fetchByPrimaryKey(long valueId)
529         throws SystemException {
530         ExpandoValue expandoValue = (ExpandoValue)EntityCacheUtil.getResult(ExpandoValueModelImpl.ENTITY_CACHE_ENABLED,
531                 ExpandoValueImpl.class, valueId, this);
532 
533         if (expandoValue == null) {
534             Session session = null;
535 
536             try {
537                 session = openSession();
538 
539                 expandoValue = (ExpandoValue)session.get(ExpandoValueImpl.class,
540                         new Long(valueId));
541             }
542             catch (Exception e) {
543                 throw processException(e);
544             }
545             finally {
546                 if (expandoValue != null) {
547                     cacheResult(expandoValue);
548                 }
549 
550                 closeSession(session);
551             }
552         }
553 
554         return expandoValue;
555     }
556 
557     public List<ExpandoValue> findByTableId(long tableId)
558         throws SystemException {
559         Object[] finderArgs = new Object[] { new Long(tableId) };
560 
561         List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TABLEID,
562                 finderArgs, this);
563 
564         if (list == null) {
565             Session session = null;
566 
567             try {
568                 session = openSession();
569 
570                 StringBundler query = new StringBundler(3);
571 
572                 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
573 
574                 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
575 
576                 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
577 
578                 String sql = query.toString();
579 
580                 Query q = session.createQuery(sql);
581 
582                 QueryPos qPos = QueryPos.getInstance(q);
583 
584                 qPos.add(tableId);
585 
586                 list = q.list();
587             }
588             catch (Exception e) {
589                 throw processException(e);
590             }
591             finally {
592                 if (list == null) {
593                     list = new ArrayList<ExpandoValue>();
594                 }
595 
596                 cacheResult(list);
597 
598                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TABLEID,
599                     finderArgs, list);
600 
601                 closeSession(session);
602             }
603         }
604 
605         return list;
606     }
607 
608     public List<ExpandoValue> findByTableId(long tableId, int start, int end)
609         throws SystemException {
610         return findByTableId(tableId, start, end, null);
611     }
612 
613     public List<ExpandoValue> findByTableId(long tableId, int start, int end,
614         OrderByComparator obc) throws SystemException {
615         Object[] finderArgs = new Object[] {
616                 new Long(tableId),
617                 
618                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
619             };
620 
621         List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TABLEID,
622                 finderArgs, this);
623 
624         if (list == null) {
625             Session session = null;
626 
627             try {
628                 session = openSession();
629 
630                 StringBundler query = null;
631 
632                 if (obc != null) {
633                     query = new StringBundler(3 +
634                             (obc.getOrderByFields().length * 3));
635                 }
636                 else {
637                     query = new StringBundler(3);
638                 }
639 
640                 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
641 
642                 query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
643 
644                 if (obc != null) {
645                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
646                 }
647 
648                 else {
649                     query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
650                 }
651 
652                 String sql = query.toString();
653 
654                 Query q = session.createQuery(sql);
655 
656                 QueryPos qPos = QueryPos.getInstance(q);
657 
658                 qPos.add(tableId);
659 
660                 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
661                         start, end);
662             }
663             catch (Exception e) {
664                 throw processException(e);
665             }
666             finally {
667                 if (list == null) {
668                     list = new ArrayList<ExpandoValue>();
669                 }
670 
671                 cacheResult(list);
672 
673                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TABLEID,
674                     finderArgs, list);
675 
676                 closeSession(session);
677             }
678         }
679 
680         return list;
681     }
682 
683     public ExpandoValue findByTableId_First(long tableId, OrderByComparator obc)
684         throws NoSuchValueException, SystemException {
685         List<ExpandoValue> list = findByTableId(tableId, 0, 1, obc);
686 
687         if (list.isEmpty()) {
688             StringBundler msg = new StringBundler(4);
689 
690             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
691 
692             msg.append("tableId=");
693             msg.append(tableId);
694 
695             msg.append(StringPool.CLOSE_CURLY_BRACE);
696 
697             throw new NoSuchValueException(msg.toString());
698         }
699         else {
700             return list.get(0);
701         }
702     }
703 
704     public ExpandoValue findByTableId_Last(long tableId, OrderByComparator obc)
705         throws NoSuchValueException, SystemException {
706         int count = countByTableId(tableId);
707 
708         List<ExpandoValue> list = findByTableId(tableId, count - 1, count, obc);
709 
710         if (list.isEmpty()) {
711             StringBundler msg = new StringBundler(4);
712 
713             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
714 
715             msg.append("tableId=");
716             msg.append(tableId);
717 
718             msg.append(StringPool.CLOSE_CURLY_BRACE);
719 
720             throw new NoSuchValueException(msg.toString());
721         }
722         else {
723             return list.get(0);
724         }
725     }
726 
727     public ExpandoValue[] findByTableId_PrevAndNext(long valueId, long tableId,
728         OrderByComparator obc) throws NoSuchValueException, SystemException {
729         ExpandoValue expandoValue = findByPrimaryKey(valueId);
730 
731         int count = countByTableId(tableId);
732 
733         Session session = null;
734 
735         try {
736             session = openSession();
737 
738             StringBundler query = null;
739 
740             if (obc != null) {
741                 query = new StringBundler(3 +
742                         (obc.getOrderByFields().length * 3));
743             }
744             else {
745                 query = new StringBundler(3);
746             }
747 
748             query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
749 
750             query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
751 
752             if (obc != null) {
753                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
754             }
755 
756             else {
757                 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
758             }
759 
760             String sql = query.toString();
761 
762             Query q = session.createQuery(sql);
763 
764             QueryPos qPos = QueryPos.getInstance(q);
765 
766             qPos.add(tableId);
767 
768             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
769                     expandoValue);
770 
771             ExpandoValue[] array = new ExpandoValueImpl[3];
772 
773             array[0] = (ExpandoValue)objArray[0];
774             array[1] = (ExpandoValue)objArray[1];
775             array[2] = (ExpandoValue)objArray[2];
776 
777             return array;
778         }
779         catch (Exception e) {
780             throw processException(e);
781         }
782         finally {
783             closeSession(session);
784         }
785     }
786 
787     public List<ExpandoValue> findByColumnId(long columnId)
788         throws SystemException {
789         Object[] finderArgs = new Object[] { new Long(columnId) };
790 
791         List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COLUMNID,
792                 finderArgs, this);
793 
794         if (list == null) {
795             Session session = null;
796 
797             try {
798                 session = openSession();
799 
800                 StringBundler query = new StringBundler(3);
801 
802                 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
803 
804                 query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
805 
806                 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
807 
808                 String sql = query.toString();
809 
810                 Query q = session.createQuery(sql);
811 
812                 QueryPos qPos = QueryPos.getInstance(q);
813 
814                 qPos.add(columnId);
815 
816                 list = q.list();
817             }
818             catch (Exception e) {
819                 throw processException(e);
820             }
821             finally {
822                 if (list == null) {
823                     list = new ArrayList<ExpandoValue>();
824                 }
825 
826                 cacheResult(list);
827 
828                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COLUMNID,
829                     finderArgs, list);
830 
831                 closeSession(session);
832             }
833         }
834 
835         return list;
836     }
837 
838     public List<ExpandoValue> findByColumnId(long columnId, int start, int end)
839         throws SystemException {
840         return findByColumnId(columnId, start, end, null);
841     }
842 
843     public List<ExpandoValue> findByColumnId(long columnId, int start, int end,
844         OrderByComparator obc) throws SystemException {
845         Object[] finderArgs = new Object[] {
846                 new Long(columnId),
847                 
848                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
849             };
850 
851         List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COLUMNID,
852                 finderArgs, this);
853 
854         if (list == null) {
855             Session session = null;
856 
857             try {
858                 session = openSession();
859 
860                 StringBundler query = null;
861 
862                 if (obc != null) {
863                     query = new StringBundler(3 +
864                             (obc.getOrderByFields().length * 3));
865                 }
866                 else {
867                     query = new StringBundler(3);
868                 }
869 
870                 query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
871 
872                 query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
873 
874                 if (obc != null) {
875                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
876                 }
877 
878                 else {
879                     query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
880                 }
881 
882                 String sql = query.toString();
883 
884                 Query q = session.createQuery(sql);
885 
886                 QueryPos qPos = QueryPos.getInstance(q);
887 
888                 qPos.add(columnId);
889 
890                 list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
891                         start, end);
892             }
893             catch (Exception e) {
894                 throw processException(e);
895             }
896             finally {
897                 if (list == null) {
898                     list = new ArrayList<ExpandoValue>();
899                 }
900 
901                 cacheResult(list);
902 
903                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COLUMNID,
904                     finderArgs, list);
905 
906                 closeSession(session);
907             }
908         }
909 
910         return list;
911     }
912 
913     public ExpandoValue findByColumnId_First(long columnId,
914         OrderByComparator obc) throws NoSuchValueException, SystemException {
915         List<ExpandoValue> list = findByColumnId(columnId, 0, 1, obc);
916 
917         if (list.isEmpty()) {
918             StringBundler msg = new StringBundler(4);
919 
920             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
921 
922             msg.append("columnId=");
923             msg.append(columnId);
924 
925             msg.append(StringPool.CLOSE_CURLY_BRACE);
926 
927             throw new NoSuchValueException(msg.toString());
928         }
929         else {
930             return list.get(0);
931         }
932     }
933 
934     public ExpandoValue findByColumnId_Last(long columnId, OrderByComparator obc)
935         throws NoSuchValueException, SystemException {
936         int count = countByColumnId(columnId);
937 
938         List<ExpandoValue> list = findByColumnId(columnId, count - 1, count, obc);
939 
940         if (list.isEmpty()) {
941             StringBundler msg = new StringBundler(4);
942 
943             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
944 
945             msg.append("columnId=");
946             msg.append(columnId);
947 
948             msg.append(StringPool.CLOSE_CURLY_BRACE);
949 
950             throw new NoSuchValueException(msg.toString());
951         }
952         else {
953             return list.get(0);
954         }
955     }
956 
957     public ExpandoValue[] findByColumnId_PrevAndNext(long valueId,
958         long columnId, OrderByComparator obc)
959         throws NoSuchValueException, SystemException {
960         ExpandoValue expandoValue = findByPrimaryKey(valueId);
961 
962         int count = countByColumnId(columnId);
963 
964         Session session = null;
965 
966         try {
967             session = openSession();
968 
969             StringBundler query = null;
970 
971             if (obc != null) {
972                 query = new StringBundler(3 +
973                         (obc.getOrderByFields().length * 3));
974             }
975             else {
976                 query = new StringBundler(3);
977             }
978 
979             query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
980 
981             query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
982 
983             if (obc != null) {
984                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
985             }
986 
987             else {
988                 query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
989             }
990 
991             String sql = query.toString();
992 
993             Query q = session.createQuery(sql);
994 
995             QueryPos qPos = QueryPos.getInstance(q);
996 
997             qPos.add(columnId);
998 
999             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1000                    expandoValue);
1001
1002            ExpandoValue[] array = new ExpandoValueImpl[3];
1003
1004            array[0] = (ExpandoValue)objArray[0];
1005            array[1] = (ExpandoValue)objArray[1];
1006            array[2] = (ExpandoValue)objArray[2];
1007
1008            return array;
1009        }
1010        catch (Exception e) {
1011            throw processException(e);
1012        }
1013        finally {
1014            closeSession(session);
1015        }
1016    }
1017
1018    public List<ExpandoValue> findByRowId(long rowId) throws SystemException {
1019        Object[] finderArgs = new Object[] { new Long(rowId) };
1020
1021        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ROWID,
1022                finderArgs, this);
1023
1024        if (list == null) {
1025            Session session = null;
1026
1027            try {
1028                session = openSession();
1029
1030                StringBundler query = new StringBundler(3);
1031
1032                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1033
1034                query.append(_FINDER_COLUMN_ROWID_ROWID_2);
1035
1036                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1037
1038                String sql = query.toString();
1039
1040                Query q = session.createQuery(sql);
1041
1042                QueryPos qPos = QueryPos.getInstance(q);
1043
1044                qPos.add(rowId);
1045
1046                list = q.list();
1047            }
1048            catch (Exception e) {
1049                throw processException(e);
1050            }
1051            finally {
1052                if (list == null) {
1053                    list = new ArrayList<ExpandoValue>();
1054                }
1055
1056                cacheResult(list);
1057
1058                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ROWID,
1059                    finderArgs, list);
1060
1061                closeSession(session);
1062            }
1063        }
1064
1065        return list;
1066    }
1067
1068    public List<ExpandoValue> findByRowId(long rowId, int start, int end)
1069        throws SystemException {
1070        return findByRowId(rowId, start, end, null);
1071    }
1072
1073    public List<ExpandoValue> findByRowId(long rowId, int start, int end,
1074        OrderByComparator obc) throws SystemException {
1075        Object[] finderArgs = new Object[] {
1076                new Long(rowId),
1077                
1078                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1079            };
1080
1081        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_ROWID,
1082                finderArgs, this);
1083
1084        if (list == null) {
1085            Session session = null;
1086
1087            try {
1088                session = openSession();
1089
1090                StringBundler query = null;
1091
1092                if (obc != null) {
1093                    query = new StringBundler(3 +
1094                            (obc.getOrderByFields().length * 3));
1095                }
1096                else {
1097                    query = new StringBundler(3);
1098                }
1099
1100                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1101
1102                query.append(_FINDER_COLUMN_ROWID_ROWID_2);
1103
1104                if (obc != null) {
1105                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1106                }
1107
1108                else {
1109                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1110                }
1111
1112                String sql = query.toString();
1113
1114                Query q = session.createQuery(sql);
1115
1116                QueryPos qPos = QueryPos.getInstance(q);
1117
1118                qPos.add(rowId);
1119
1120                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1121                        start, end);
1122            }
1123            catch (Exception e) {
1124                throw processException(e);
1125            }
1126            finally {
1127                if (list == null) {
1128                    list = new ArrayList<ExpandoValue>();
1129                }
1130
1131                cacheResult(list);
1132
1133                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_ROWID,
1134                    finderArgs, list);
1135
1136                closeSession(session);
1137            }
1138        }
1139
1140        return list;
1141    }
1142
1143    public ExpandoValue findByRowId_First(long rowId, OrderByComparator obc)
1144        throws NoSuchValueException, SystemException {
1145        List<ExpandoValue> list = findByRowId(rowId, 0, 1, obc);
1146
1147        if (list.isEmpty()) {
1148            StringBundler msg = new StringBundler(4);
1149
1150            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1151
1152            msg.append("rowId=");
1153            msg.append(rowId);
1154
1155            msg.append(StringPool.CLOSE_CURLY_BRACE);
1156
1157            throw new NoSuchValueException(msg.toString());
1158        }
1159        else {
1160            return list.get(0);
1161        }
1162    }
1163
1164    public ExpandoValue findByRowId_Last(long rowId, OrderByComparator obc)
1165        throws NoSuchValueException, SystemException {
1166        int count = countByRowId(rowId);
1167
1168        List<ExpandoValue> list = findByRowId(rowId, count - 1, count, obc);
1169
1170        if (list.isEmpty()) {
1171            StringBundler msg = new StringBundler(4);
1172
1173            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1174
1175            msg.append("rowId=");
1176            msg.append(rowId);
1177
1178            msg.append(StringPool.CLOSE_CURLY_BRACE);
1179
1180            throw new NoSuchValueException(msg.toString());
1181        }
1182        else {
1183            return list.get(0);
1184        }
1185    }
1186
1187    public ExpandoValue[] findByRowId_PrevAndNext(long valueId, long rowId,
1188        OrderByComparator obc) throws NoSuchValueException, SystemException {
1189        ExpandoValue expandoValue = findByPrimaryKey(valueId);
1190
1191        int count = countByRowId(rowId);
1192
1193        Session session = null;
1194
1195        try {
1196            session = openSession();
1197
1198            StringBundler query = null;
1199
1200            if (obc != null) {
1201                query = new StringBundler(3 +
1202                        (obc.getOrderByFields().length * 3));
1203            }
1204            else {
1205                query = new StringBundler(3);
1206            }
1207
1208            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1209
1210            query.append(_FINDER_COLUMN_ROWID_ROWID_2);
1211
1212            if (obc != null) {
1213                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1214            }
1215
1216            else {
1217                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1218            }
1219
1220            String sql = query.toString();
1221
1222            Query q = session.createQuery(sql);
1223
1224            QueryPos qPos = QueryPos.getInstance(q);
1225
1226            qPos.add(rowId);
1227
1228            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1229                    expandoValue);
1230
1231            ExpandoValue[] array = new ExpandoValueImpl[3];
1232
1233            array[0] = (ExpandoValue)objArray[0];
1234            array[1] = (ExpandoValue)objArray[1];
1235            array[2] = (ExpandoValue)objArray[2];
1236
1237            return array;
1238        }
1239        catch (Exception e) {
1240            throw processException(e);
1241        }
1242        finally {
1243            closeSession(session);
1244        }
1245    }
1246
1247    public List<ExpandoValue> findByT_C(long tableId, long columnId)
1248        throws SystemException {
1249        Object[] finderArgs = new Object[] { new Long(tableId), new Long(columnId) };
1250
1251        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_C,
1252                finderArgs, this);
1253
1254        if (list == null) {
1255            Session session = null;
1256
1257            try {
1258                session = openSession();
1259
1260                StringBundler query = new StringBundler(4);
1261
1262                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1263
1264                query.append(_FINDER_COLUMN_T_C_TABLEID_2);
1265
1266                query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
1267
1268                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1269
1270                String sql = query.toString();
1271
1272                Query q = session.createQuery(sql);
1273
1274                QueryPos qPos = QueryPos.getInstance(q);
1275
1276                qPos.add(tableId);
1277
1278                qPos.add(columnId);
1279
1280                list = q.list();
1281            }
1282            catch (Exception e) {
1283                throw processException(e);
1284            }
1285            finally {
1286                if (list == null) {
1287                    list = new ArrayList<ExpandoValue>();
1288                }
1289
1290                cacheResult(list);
1291
1292                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_C, finderArgs,
1293                    list);
1294
1295                closeSession(session);
1296            }
1297        }
1298
1299        return list;
1300    }
1301
1302    public List<ExpandoValue> findByT_C(long tableId, long columnId, int start,
1303        int end) throws SystemException {
1304        return findByT_C(tableId, columnId, start, end, null);
1305    }
1306
1307    public List<ExpandoValue> findByT_C(long tableId, long columnId, int start,
1308        int end, OrderByComparator obc) throws SystemException {
1309        Object[] finderArgs = new Object[] {
1310                new Long(tableId), new Long(columnId),
1311                
1312                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1313            };
1314
1315        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_C,
1316                finderArgs, this);
1317
1318        if (list == null) {
1319            Session session = null;
1320
1321            try {
1322                session = openSession();
1323
1324                StringBundler query = null;
1325
1326                if (obc != null) {
1327                    query = new StringBundler(4 +
1328                            (obc.getOrderByFields().length * 3));
1329                }
1330                else {
1331                    query = new StringBundler(4);
1332                }
1333
1334                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1335
1336                query.append(_FINDER_COLUMN_T_C_TABLEID_2);
1337
1338                query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
1339
1340                if (obc != null) {
1341                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1342                }
1343
1344                else {
1345                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1346                }
1347
1348                String sql = query.toString();
1349
1350                Query q = session.createQuery(sql);
1351
1352                QueryPos qPos = QueryPos.getInstance(q);
1353
1354                qPos.add(tableId);
1355
1356                qPos.add(columnId);
1357
1358                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1359                        start, end);
1360            }
1361            catch (Exception e) {
1362                throw processException(e);
1363            }
1364            finally {
1365                if (list == null) {
1366                    list = new ArrayList<ExpandoValue>();
1367                }
1368
1369                cacheResult(list);
1370
1371                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_C,
1372                    finderArgs, list);
1373
1374                closeSession(session);
1375            }
1376        }
1377
1378        return list;
1379    }
1380
1381    public ExpandoValue findByT_C_First(long tableId, long columnId,
1382        OrderByComparator obc) throws NoSuchValueException, SystemException {
1383        List<ExpandoValue> list = findByT_C(tableId, columnId, 0, 1, obc);
1384
1385        if (list.isEmpty()) {
1386            StringBundler msg = new StringBundler(6);
1387
1388            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1389
1390            msg.append("tableId=");
1391            msg.append(tableId);
1392
1393            msg.append(", columnId=");
1394            msg.append(columnId);
1395
1396            msg.append(StringPool.CLOSE_CURLY_BRACE);
1397
1398            throw new NoSuchValueException(msg.toString());
1399        }
1400        else {
1401            return list.get(0);
1402        }
1403    }
1404
1405    public ExpandoValue findByT_C_Last(long tableId, long columnId,
1406        OrderByComparator obc) throws NoSuchValueException, SystemException {
1407        int count = countByT_C(tableId, columnId);
1408
1409        List<ExpandoValue> list = findByT_C(tableId, columnId, count - 1,
1410                count, obc);
1411
1412        if (list.isEmpty()) {
1413            StringBundler msg = new StringBundler(6);
1414
1415            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1416
1417            msg.append("tableId=");
1418            msg.append(tableId);
1419
1420            msg.append(", columnId=");
1421            msg.append(columnId);
1422
1423            msg.append(StringPool.CLOSE_CURLY_BRACE);
1424
1425            throw new NoSuchValueException(msg.toString());
1426        }
1427        else {
1428            return list.get(0);
1429        }
1430    }
1431
1432    public ExpandoValue[] findByT_C_PrevAndNext(long valueId, long tableId,
1433        long columnId, OrderByComparator obc)
1434        throws NoSuchValueException, SystemException {
1435        ExpandoValue expandoValue = findByPrimaryKey(valueId);
1436
1437        int count = countByT_C(tableId, columnId);
1438
1439        Session session = null;
1440
1441        try {
1442            session = openSession();
1443
1444            StringBundler query = null;
1445
1446            if (obc != null) {
1447                query = new StringBundler(4 +
1448                        (obc.getOrderByFields().length * 3));
1449            }
1450            else {
1451                query = new StringBundler(4);
1452            }
1453
1454            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1455
1456            query.append(_FINDER_COLUMN_T_C_TABLEID_2);
1457
1458            query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
1459
1460            if (obc != null) {
1461                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1462            }
1463
1464            else {
1465                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1466            }
1467
1468            String sql = query.toString();
1469
1470            Query q = session.createQuery(sql);
1471
1472            QueryPos qPos = QueryPos.getInstance(q);
1473
1474            qPos.add(tableId);
1475
1476            qPos.add(columnId);
1477
1478            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1479                    expandoValue);
1480
1481            ExpandoValue[] array = new ExpandoValueImpl[3];
1482
1483            array[0] = (ExpandoValue)objArray[0];
1484            array[1] = (ExpandoValue)objArray[1];
1485            array[2] = (ExpandoValue)objArray[2];
1486
1487            return array;
1488        }
1489        catch (Exception e) {
1490            throw processException(e);
1491        }
1492        finally {
1493            closeSession(session);
1494        }
1495    }
1496
1497    public List<ExpandoValue> findByT_CPK(long tableId, long classPK)
1498        throws SystemException {
1499        Object[] finderArgs = new Object[] { new Long(tableId), new Long(classPK) };
1500
1501        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_CPK,
1502                finderArgs, this);
1503
1504        if (list == null) {
1505            Session session = null;
1506
1507            try {
1508                session = openSession();
1509
1510                StringBundler query = new StringBundler(4);
1511
1512                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1513
1514                query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
1515
1516                query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
1517
1518                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1519
1520                String sql = query.toString();
1521
1522                Query q = session.createQuery(sql);
1523
1524                QueryPos qPos = QueryPos.getInstance(q);
1525
1526                qPos.add(tableId);
1527
1528                qPos.add(classPK);
1529
1530                list = q.list();
1531            }
1532            catch (Exception e) {
1533                throw processException(e);
1534            }
1535            finally {
1536                if (list == null) {
1537                    list = new ArrayList<ExpandoValue>();
1538                }
1539
1540                cacheResult(list);
1541
1542                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_CPK,
1543                    finderArgs, list);
1544
1545                closeSession(session);
1546            }
1547        }
1548
1549        return list;
1550    }
1551
1552    public List<ExpandoValue> findByT_CPK(long tableId, long classPK,
1553        int start, int end) throws SystemException {
1554        return findByT_CPK(tableId, classPK, start, end, null);
1555    }
1556
1557    public List<ExpandoValue> findByT_CPK(long tableId, long classPK,
1558        int start, int end, OrderByComparator obc) throws SystemException {
1559        Object[] finderArgs = new Object[] {
1560                new Long(tableId), new Long(classPK),
1561                
1562                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1563            };
1564
1565        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_CPK,
1566                finderArgs, this);
1567
1568        if (list == null) {
1569            Session session = null;
1570
1571            try {
1572                session = openSession();
1573
1574                StringBundler query = null;
1575
1576                if (obc != null) {
1577                    query = new StringBundler(4 +
1578                            (obc.getOrderByFields().length * 3));
1579                }
1580                else {
1581                    query = new StringBundler(4);
1582                }
1583
1584                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1585
1586                query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
1587
1588                query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
1589
1590                if (obc != null) {
1591                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1592                }
1593
1594                else {
1595                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1596                }
1597
1598                String sql = query.toString();
1599
1600                Query q = session.createQuery(sql);
1601
1602                QueryPos qPos = QueryPos.getInstance(q);
1603
1604                qPos.add(tableId);
1605
1606                qPos.add(classPK);
1607
1608                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1609                        start, end);
1610            }
1611            catch (Exception e) {
1612                throw processException(e);
1613            }
1614            finally {
1615                if (list == null) {
1616                    list = new ArrayList<ExpandoValue>();
1617                }
1618
1619                cacheResult(list);
1620
1621                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_CPK,
1622                    finderArgs, list);
1623
1624                closeSession(session);
1625            }
1626        }
1627
1628        return list;
1629    }
1630
1631    public ExpandoValue findByT_CPK_First(long tableId, long classPK,
1632        OrderByComparator obc) throws NoSuchValueException, SystemException {
1633        List<ExpandoValue> list = findByT_CPK(tableId, classPK, 0, 1, obc);
1634
1635        if (list.isEmpty()) {
1636            StringBundler msg = new StringBundler(6);
1637
1638            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1639
1640            msg.append("tableId=");
1641            msg.append(tableId);
1642
1643            msg.append(", classPK=");
1644            msg.append(classPK);
1645
1646            msg.append(StringPool.CLOSE_CURLY_BRACE);
1647
1648            throw new NoSuchValueException(msg.toString());
1649        }
1650        else {
1651            return list.get(0);
1652        }
1653    }
1654
1655    public ExpandoValue findByT_CPK_Last(long tableId, long classPK,
1656        OrderByComparator obc) throws NoSuchValueException, SystemException {
1657        int count = countByT_CPK(tableId, classPK);
1658
1659        List<ExpandoValue> list = findByT_CPK(tableId, classPK, count - 1,
1660                count, obc);
1661
1662        if (list.isEmpty()) {
1663            StringBundler msg = new StringBundler(6);
1664
1665            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1666
1667            msg.append("tableId=");
1668            msg.append(tableId);
1669
1670            msg.append(", classPK=");
1671            msg.append(classPK);
1672
1673            msg.append(StringPool.CLOSE_CURLY_BRACE);
1674
1675            throw new NoSuchValueException(msg.toString());
1676        }
1677        else {
1678            return list.get(0);
1679        }
1680    }
1681
1682    public ExpandoValue[] findByT_CPK_PrevAndNext(long valueId, long tableId,
1683        long classPK, OrderByComparator obc)
1684        throws NoSuchValueException, SystemException {
1685        ExpandoValue expandoValue = findByPrimaryKey(valueId);
1686
1687        int count = countByT_CPK(tableId, classPK);
1688
1689        Session session = null;
1690
1691        try {
1692            session = openSession();
1693
1694            StringBundler query = null;
1695
1696            if (obc != null) {
1697                query = new StringBundler(4 +
1698                        (obc.getOrderByFields().length * 3));
1699            }
1700            else {
1701                query = new StringBundler(4);
1702            }
1703
1704            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1705
1706            query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
1707
1708            query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
1709
1710            if (obc != null) {
1711                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1712            }
1713
1714            else {
1715                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1716            }
1717
1718            String sql = query.toString();
1719
1720            Query q = session.createQuery(sql);
1721
1722            QueryPos qPos = QueryPos.getInstance(q);
1723
1724            qPos.add(tableId);
1725
1726            qPos.add(classPK);
1727
1728            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1729                    expandoValue);
1730
1731            ExpandoValue[] array = new ExpandoValueImpl[3];
1732
1733            array[0] = (ExpandoValue)objArray[0];
1734            array[1] = (ExpandoValue)objArray[1];
1735            array[2] = (ExpandoValue)objArray[2];
1736
1737            return array;
1738        }
1739        catch (Exception e) {
1740            throw processException(e);
1741        }
1742        finally {
1743            closeSession(session);
1744        }
1745    }
1746
1747    public List<ExpandoValue> findByT_R(long tableId, long rowId)
1748        throws SystemException {
1749        Object[] finderArgs = new Object[] { new Long(tableId), new Long(rowId) };
1750
1751        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_R,
1752                finderArgs, this);
1753
1754        if (list == null) {
1755            Session session = null;
1756
1757            try {
1758                session = openSession();
1759
1760                StringBundler query = new StringBundler(4);
1761
1762                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1763
1764                query.append(_FINDER_COLUMN_T_R_TABLEID_2);
1765
1766                query.append(_FINDER_COLUMN_T_R_ROWID_2);
1767
1768                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1769
1770                String sql = query.toString();
1771
1772                Query q = session.createQuery(sql);
1773
1774                QueryPos qPos = QueryPos.getInstance(q);
1775
1776                qPos.add(tableId);
1777
1778                qPos.add(rowId);
1779
1780                list = q.list();
1781            }
1782            catch (Exception e) {
1783                throw processException(e);
1784            }
1785            finally {
1786                if (list == null) {
1787                    list = new ArrayList<ExpandoValue>();
1788                }
1789
1790                cacheResult(list);
1791
1792                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_R, finderArgs,
1793                    list);
1794
1795                closeSession(session);
1796            }
1797        }
1798
1799        return list;
1800    }
1801
1802    public List<ExpandoValue> findByT_R(long tableId, long rowId, int start,
1803        int end) throws SystemException {
1804        return findByT_R(tableId, rowId, start, end, null);
1805    }
1806
1807    public List<ExpandoValue> findByT_R(long tableId, long rowId, int start,
1808        int end, OrderByComparator obc) throws SystemException {
1809        Object[] finderArgs = new Object[] {
1810                new Long(tableId), new Long(rowId),
1811                
1812                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1813            };
1814
1815        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_R,
1816                finderArgs, this);
1817
1818        if (list == null) {
1819            Session session = null;
1820
1821            try {
1822                session = openSession();
1823
1824                StringBundler query = null;
1825
1826                if (obc != null) {
1827                    query = new StringBundler(4 +
1828                            (obc.getOrderByFields().length * 3));
1829                }
1830                else {
1831                    query = new StringBundler(4);
1832                }
1833
1834                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1835
1836                query.append(_FINDER_COLUMN_T_R_TABLEID_2);
1837
1838                query.append(_FINDER_COLUMN_T_R_ROWID_2);
1839
1840                if (obc != null) {
1841                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1842                }
1843
1844                else {
1845                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1846                }
1847
1848                String sql = query.toString();
1849
1850                Query q = session.createQuery(sql);
1851
1852                QueryPos qPos = QueryPos.getInstance(q);
1853
1854                qPos.add(tableId);
1855
1856                qPos.add(rowId);
1857
1858                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
1859                        start, end);
1860            }
1861            catch (Exception e) {
1862                throw processException(e);
1863            }
1864            finally {
1865                if (list == null) {
1866                    list = new ArrayList<ExpandoValue>();
1867                }
1868
1869                cacheResult(list);
1870
1871                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_R,
1872                    finderArgs, list);
1873
1874                closeSession(session);
1875            }
1876        }
1877
1878        return list;
1879    }
1880
1881    public ExpandoValue findByT_R_First(long tableId, long rowId,
1882        OrderByComparator obc) throws NoSuchValueException, SystemException {
1883        List<ExpandoValue> list = findByT_R(tableId, rowId, 0, 1, obc);
1884
1885        if (list.isEmpty()) {
1886            StringBundler msg = new StringBundler(6);
1887
1888            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1889
1890            msg.append("tableId=");
1891            msg.append(tableId);
1892
1893            msg.append(", rowId=");
1894            msg.append(rowId);
1895
1896            msg.append(StringPool.CLOSE_CURLY_BRACE);
1897
1898            throw new NoSuchValueException(msg.toString());
1899        }
1900        else {
1901            return list.get(0);
1902        }
1903    }
1904
1905    public ExpandoValue findByT_R_Last(long tableId, long rowId,
1906        OrderByComparator obc) throws NoSuchValueException, SystemException {
1907        int count = countByT_R(tableId, rowId);
1908
1909        List<ExpandoValue> list = findByT_R(tableId, rowId, count - 1, count,
1910                obc);
1911
1912        if (list.isEmpty()) {
1913            StringBundler msg = new StringBundler(6);
1914
1915            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1916
1917            msg.append("tableId=");
1918            msg.append(tableId);
1919
1920            msg.append(", rowId=");
1921            msg.append(rowId);
1922
1923            msg.append(StringPool.CLOSE_CURLY_BRACE);
1924
1925            throw new NoSuchValueException(msg.toString());
1926        }
1927        else {
1928            return list.get(0);
1929        }
1930    }
1931
1932    public ExpandoValue[] findByT_R_PrevAndNext(long valueId, long tableId,
1933        long rowId, OrderByComparator obc)
1934        throws NoSuchValueException, SystemException {
1935        ExpandoValue expandoValue = findByPrimaryKey(valueId);
1936
1937        int count = countByT_R(tableId, rowId);
1938
1939        Session session = null;
1940
1941        try {
1942            session = openSession();
1943
1944            StringBundler query = null;
1945
1946            if (obc != null) {
1947                query = new StringBundler(4 +
1948                        (obc.getOrderByFields().length * 3));
1949            }
1950            else {
1951                query = new StringBundler(4);
1952            }
1953
1954            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
1955
1956            query.append(_FINDER_COLUMN_T_R_TABLEID_2);
1957
1958            query.append(_FINDER_COLUMN_T_R_ROWID_2);
1959
1960            if (obc != null) {
1961                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
1962            }
1963
1964            else {
1965                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
1966            }
1967
1968            String sql = query.toString();
1969
1970            Query q = session.createQuery(sql);
1971
1972            QueryPos qPos = QueryPos.getInstance(q);
1973
1974            qPos.add(tableId);
1975
1976            qPos.add(rowId);
1977
1978            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1979                    expandoValue);
1980
1981            ExpandoValue[] array = new ExpandoValueImpl[3];
1982
1983            array[0] = (ExpandoValue)objArray[0];
1984            array[1] = (ExpandoValue)objArray[1];
1985            array[2] = (ExpandoValue)objArray[2];
1986
1987            return array;
1988        }
1989        catch (Exception e) {
1990            throw processException(e);
1991        }
1992        finally {
1993            closeSession(session);
1994        }
1995    }
1996
1997    public ExpandoValue findByC_R(long columnId, long rowId)
1998        throws NoSuchValueException, SystemException {
1999        ExpandoValue expandoValue = fetchByC_R(columnId, rowId);
2000
2001        if (expandoValue == null) {
2002            StringBundler msg = new StringBundler(6);
2003
2004            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2005
2006            msg.append("columnId=");
2007            msg.append(columnId);
2008
2009            msg.append(", rowId=");
2010            msg.append(rowId);
2011
2012            msg.append(StringPool.CLOSE_CURLY_BRACE);
2013
2014            if (_log.isWarnEnabled()) {
2015                _log.warn(msg.toString());
2016            }
2017
2018            throw new NoSuchValueException(msg.toString());
2019        }
2020
2021        return expandoValue;
2022    }
2023
2024    public ExpandoValue fetchByC_R(long columnId, long rowId)
2025        throws SystemException {
2026        return fetchByC_R(columnId, rowId, true);
2027    }
2028
2029    public ExpandoValue fetchByC_R(long columnId, long rowId,
2030        boolean retrieveFromCache) throws SystemException {
2031        Object[] finderArgs = new Object[] { new Long(columnId), new Long(rowId) };
2032
2033        Object result = null;
2034
2035        if (retrieveFromCache) {
2036            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_R,
2037                    finderArgs, this);
2038        }
2039
2040        if (result == null) {
2041            Session session = null;
2042
2043            try {
2044                session = openSession();
2045
2046                StringBundler query = new StringBundler(4);
2047
2048                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2049
2050                query.append(_FINDER_COLUMN_C_R_COLUMNID_2);
2051
2052                query.append(_FINDER_COLUMN_C_R_ROWID_2);
2053
2054                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2055
2056                String sql = query.toString();
2057
2058                Query q = session.createQuery(sql);
2059
2060                QueryPos qPos = QueryPos.getInstance(q);
2061
2062                qPos.add(columnId);
2063
2064                qPos.add(rowId);
2065
2066                List<ExpandoValue> list = q.list();
2067
2068                result = list;
2069
2070                ExpandoValue expandoValue = null;
2071
2072                if (list.isEmpty()) {
2073                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
2074                        finderArgs, list);
2075                }
2076                else {
2077                    expandoValue = list.get(0);
2078
2079                    cacheResult(expandoValue);
2080
2081                    if ((expandoValue.getColumnId() != columnId) ||
2082                            (expandoValue.getRowId() != rowId)) {
2083                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
2084                            finderArgs, expandoValue);
2085                    }
2086                }
2087
2088                return expandoValue;
2089            }
2090            catch (Exception e) {
2091                throw processException(e);
2092            }
2093            finally {
2094                if (result == null) {
2095                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_R,
2096                        finderArgs, new ArrayList<ExpandoValue>());
2097                }
2098
2099                closeSession(session);
2100            }
2101        }
2102        else {
2103            if (result instanceof List<?>) {
2104                return null;
2105            }
2106            else {
2107                return (ExpandoValue)result;
2108            }
2109        }
2110    }
2111
2112    public List<ExpandoValue> findByC_C(long classNameId, long classPK)
2113        throws SystemException {
2114        Object[] finderArgs = new Object[] {
2115                new Long(classNameId), new Long(classPK)
2116            };
2117
2118        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_C,
2119                finderArgs, this);
2120
2121        if (list == null) {
2122            Session session = null;
2123
2124            try {
2125                session = openSession();
2126
2127                StringBundler query = new StringBundler(4);
2128
2129                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2130
2131                query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2132
2133                query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2134
2135                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2136
2137                String sql = query.toString();
2138
2139                Query q = session.createQuery(sql);
2140
2141                QueryPos qPos = QueryPos.getInstance(q);
2142
2143                qPos.add(classNameId);
2144
2145                qPos.add(classPK);
2146
2147                list = q.list();
2148            }
2149            catch (Exception e) {
2150                throw processException(e);
2151            }
2152            finally {
2153                if (list == null) {
2154                    list = new ArrayList<ExpandoValue>();
2155                }
2156
2157                cacheResult(list);
2158
2159                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_C, finderArgs,
2160                    list);
2161
2162                closeSession(session);
2163            }
2164        }
2165
2166        return list;
2167    }
2168
2169    public List<ExpandoValue> findByC_C(long classNameId, long classPK,
2170        int start, int end) throws SystemException {
2171        return findByC_C(classNameId, classPK, start, end, null);
2172    }
2173
2174    public List<ExpandoValue> findByC_C(long classNameId, long classPK,
2175        int start, int end, OrderByComparator obc) throws SystemException {
2176        Object[] finderArgs = new Object[] {
2177                new Long(classNameId), new Long(classPK),
2178                
2179                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2180            };
2181
2182        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_C,
2183                finderArgs, this);
2184
2185        if (list == null) {
2186            Session session = null;
2187
2188            try {
2189                session = openSession();
2190
2191                StringBundler query = null;
2192
2193                if (obc != null) {
2194                    query = new StringBundler(4 +
2195                            (obc.getOrderByFields().length * 3));
2196                }
2197                else {
2198                    query = new StringBundler(4);
2199                }
2200
2201                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2202
2203                query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2204
2205                query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2206
2207                if (obc != null) {
2208                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2209                }
2210
2211                else {
2212                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2213                }
2214
2215                String sql = query.toString();
2216
2217                Query q = session.createQuery(sql);
2218
2219                QueryPos qPos = QueryPos.getInstance(q);
2220
2221                qPos.add(classNameId);
2222
2223                qPos.add(classPK);
2224
2225                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2226                        start, end);
2227            }
2228            catch (Exception e) {
2229                throw processException(e);
2230            }
2231            finally {
2232                if (list == null) {
2233                    list = new ArrayList<ExpandoValue>();
2234                }
2235
2236                cacheResult(list);
2237
2238                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_C,
2239                    finderArgs, list);
2240
2241                closeSession(session);
2242            }
2243        }
2244
2245        return list;
2246    }
2247
2248    public ExpandoValue findByC_C_First(long classNameId, long classPK,
2249        OrderByComparator obc) throws NoSuchValueException, SystemException {
2250        List<ExpandoValue> list = findByC_C(classNameId, classPK, 0, 1, obc);
2251
2252        if (list.isEmpty()) {
2253            StringBundler msg = new StringBundler(6);
2254
2255            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2256
2257            msg.append("classNameId=");
2258            msg.append(classNameId);
2259
2260            msg.append(", classPK=");
2261            msg.append(classPK);
2262
2263            msg.append(StringPool.CLOSE_CURLY_BRACE);
2264
2265            throw new NoSuchValueException(msg.toString());
2266        }
2267        else {
2268            return list.get(0);
2269        }
2270    }
2271
2272    public ExpandoValue findByC_C_Last(long classNameId, long classPK,
2273        OrderByComparator obc) throws NoSuchValueException, SystemException {
2274        int count = countByC_C(classNameId, classPK);
2275
2276        List<ExpandoValue> list = findByC_C(classNameId, classPK, count - 1,
2277                count, obc);
2278
2279        if (list.isEmpty()) {
2280            StringBundler msg = new StringBundler(6);
2281
2282            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2283
2284            msg.append("classNameId=");
2285            msg.append(classNameId);
2286
2287            msg.append(", classPK=");
2288            msg.append(classPK);
2289
2290            msg.append(StringPool.CLOSE_CURLY_BRACE);
2291
2292            throw new NoSuchValueException(msg.toString());
2293        }
2294        else {
2295            return list.get(0);
2296        }
2297    }
2298
2299    public ExpandoValue[] findByC_C_PrevAndNext(long valueId, long classNameId,
2300        long classPK, OrderByComparator obc)
2301        throws NoSuchValueException, SystemException {
2302        ExpandoValue expandoValue = findByPrimaryKey(valueId);
2303
2304        int count = countByC_C(classNameId, classPK);
2305
2306        Session session = null;
2307
2308        try {
2309            session = openSession();
2310
2311            StringBundler query = null;
2312
2313            if (obc != null) {
2314                query = new StringBundler(4 +
2315                        (obc.getOrderByFields().length * 3));
2316            }
2317            else {
2318                query = new StringBundler(4);
2319            }
2320
2321            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2322
2323            query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2324
2325            query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2326
2327            if (obc != null) {
2328                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2329            }
2330
2331            else {
2332                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2333            }
2334
2335            String sql = query.toString();
2336
2337            Query q = session.createQuery(sql);
2338
2339            QueryPos qPos = QueryPos.getInstance(q);
2340
2341            qPos.add(classNameId);
2342
2343            qPos.add(classPK);
2344
2345            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2346                    expandoValue);
2347
2348            ExpandoValue[] array = new ExpandoValueImpl[3];
2349
2350            array[0] = (ExpandoValue)objArray[0];
2351            array[1] = (ExpandoValue)objArray[1];
2352            array[2] = (ExpandoValue)objArray[2];
2353
2354            return array;
2355        }
2356        catch (Exception e) {
2357            throw processException(e);
2358        }
2359        finally {
2360            closeSession(session);
2361        }
2362    }
2363
2364    public ExpandoValue findByT_C_C(long tableId, long columnId, long classPK)
2365        throws NoSuchValueException, SystemException {
2366        ExpandoValue expandoValue = fetchByT_C_C(tableId, columnId, classPK);
2367
2368        if (expandoValue == null) {
2369            StringBundler msg = new StringBundler(8);
2370
2371            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2372
2373            msg.append("tableId=");
2374            msg.append(tableId);
2375
2376            msg.append(", columnId=");
2377            msg.append(columnId);
2378
2379            msg.append(", classPK=");
2380            msg.append(classPK);
2381
2382            msg.append(StringPool.CLOSE_CURLY_BRACE);
2383
2384            if (_log.isWarnEnabled()) {
2385                _log.warn(msg.toString());
2386            }
2387
2388            throw new NoSuchValueException(msg.toString());
2389        }
2390
2391        return expandoValue;
2392    }
2393
2394    public ExpandoValue fetchByT_C_C(long tableId, long columnId, long classPK)
2395        throws SystemException {
2396        return fetchByT_C_C(tableId, columnId, classPK, true);
2397    }
2398
2399    public ExpandoValue fetchByT_C_C(long tableId, long columnId, long classPK,
2400        boolean retrieveFromCache) throws SystemException {
2401        Object[] finderArgs = new Object[] {
2402                new Long(tableId), new Long(columnId), new Long(classPK)
2403            };
2404
2405        Object result = null;
2406
2407        if (retrieveFromCache) {
2408            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_T_C_C,
2409                    finderArgs, this);
2410        }
2411
2412        if (result == null) {
2413            Session session = null;
2414
2415            try {
2416                session = openSession();
2417
2418                StringBundler query = new StringBundler(5);
2419
2420                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2421
2422                query.append(_FINDER_COLUMN_T_C_C_TABLEID_2);
2423
2424                query.append(_FINDER_COLUMN_T_C_C_COLUMNID_2);
2425
2426                query.append(_FINDER_COLUMN_T_C_C_CLASSPK_2);
2427
2428                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2429
2430                String sql = query.toString();
2431
2432                Query q = session.createQuery(sql);
2433
2434                QueryPos qPos = QueryPos.getInstance(q);
2435
2436                qPos.add(tableId);
2437
2438                qPos.add(columnId);
2439
2440                qPos.add(classPK);
2441
2442                List<ExpandoValue> list = q.list();
2443
2444                result = list;
2445
2446                ExpandoValue expandoValue = null;
2447
2448                if (list.isEmpty()) {
2449                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
2450                        finderArgs, list);
2451                }
2452                else {
2453                    expandoValue = list.get(0);
2454
2455                    cacheResult(expandoValue);
2456
2457                    if ((expandoValue.getTableId() != tableId) ||
2458                            (expandoValue.getColumnId() != columnId) ||
2459                            (expandoValue.getClassPK() != classPK)) {
2460                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
2461                            finderArgs, expandoValue);
2462                    }
2463                }
2464
2465                return expandoValue;
2466            }
2467            catch (Exception e) {
2468                throw processException(e);
2469            }
2470            finally {
2471                if (result == null) {
2472                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_T_C_C,
2473                        finderArgs, new ArrayList<ExpandoValue>());
2474                }
2475
2476                closeSession(session);
2477            }
2478        }
2479        else {
2480            if (result instanceof List<?>) {
2481                return null;
2482            }
2483            else {
2484                return (ExpandoValue)result;
2485            }
2486        }
2487    }
2488
2489    public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
2490        String data) throws SystemException {
2491        Object[] finderArgs = new Object[] {
2492                new Long(tableId), new Long(columnId),
2493                
2494                data
2495            };
2496
2497        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_T_C_D,
2498                finderArgs, this);
2499
2500        if (list == null) {
2501            Session session = null;
2502
2503            try {
2504                session = openSession();
2505
2506                StringBundler query = new StringBundler(5);
2507
2508                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2509
2510                query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
2511
2512                query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
2513
2514                if (data == null) {
2515                    query.append(_FINDER_COLUMN_T_C_D_DATA_1);
2516                }
2517                else {
2518                    if (data.equals(StringPool.BLANK)) {
2519                        query.append(_FINDER_COLUMN_T_C_D_DATA_3);
2520                    }
2521                    else {
2522                        query.append(_FINDER_COLUMN_T_C_D_DATA_2);
2523                    }
2524                }
2525
2526                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2527
2528                String sql = query.toString();
2529
2530                Query q = session.createQuery(sql);
2531
2532                QueryPos qPos = QueryPos.getInstance(q);
2533
2534                qPos.add(tableId);
2535
2536                qPos.add(columnId);
2537
2538                if (data != null) {
2539                    qPos.add(data);
2540                }
2541
2542                list = q.list();
2543            }
2544            catch (Exception e) {
2545                throw processException(e);
2546            }
2547            finally {
2548                if (list == null) {
2549                    list = new ArrayList<ExpandoValue>();
2550                }
2551
2552                cacheResult(list);
2553
2554                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_T_C_D,
2555                    finderArgs, list);
2556
2557                closeSession(session);
2558            }
2559        }
2560
2561        return list;
2562    }
2563
2564    public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
2565        String data, int start, int end) throws SystemException {
2566        return findByT_C_D(tableId, columnId, data, start, end, null);
2567    }
2568
2569    public List<ExpandoValue> findByT_C_D(long tableId, long columnId,
2570        String data, int start, int end, OrderByComparator obc)
2571        throws SystemException {
2572        Object[] finderArgs = new Object[] {
2573                new Long(tableId), new Long(columnId),
2574                
2575                data,
2576                
2577                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2578            };
2579
2580        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_T_C_D,
2581                finderArgs, this);
2582
2583        if (list == null) {
2584            Session session = null;
2585
2586            try {
2587                session = openSession();
2588
2589                StringBundler query = null;
2590
2591                if (obc != null) {
2592                    query = new StringBundler(5 +
2593                            (obc.getOrderByFields().length * 3));
2594                }
2595                else {
2596                    query = new StringBundler(5);
2597                }
2598
2599                query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2600
2601                query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
2602
2603                query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
2604
2605                if (data == null) {
2606                    query.append(_FINDER_COLUMN_T_C_D_DATA_1);
2607                }
2608                else {
2609                    if (data.equals(StringPool.BLANK)) {
2610                        query.append(_FINDER_COLUMN_T_C_D_DATA_3);
2611                    }
2612                    else {
2613                        query.append(_FINDER_COLUMN_T_C_D_DATA_2);
2614                    }
2615                }
2616
2617                if (obc != null) {
2618                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2619                }
2620
2621                else {
2622                    query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2623                }
2624
2625                String sql = query.toString();
2626
2627                Query q = session.createQuery(sql);
2628
2629                QueryPos qPos = QueryPos.getInstance(q);
2630
2631                qPos.add(tableId);
2632
2633                qPos.add(columnId);
2634
2635                if (data != null) {
2636                    qPos.add(data);
2637                }
2638
2639                list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2640                        start, end);
2641            }
2642            catch (Exception e) {
2643                throw processException(e);
2644            }
2645            finally {
2646                if (list == null) {
2647                    list = new ArrayList<ExpandoValue>();
2648                }
2649
2650                cacheResult(list);
2651
2652                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_T_C_D,
2653                    finderArgs, list);
2654
2655                closeSession(session);
2656            }
2657        }
2658
2659        return list;
2660    }
2661
2662    public ExpandoValue findByT_C_D_First(long tableId, long columnId,
2663        String data, OrderByComparator obc)
2664        throws NoSuchValueException, SystemException {
2665        List<ExpandoValue> list = findByT_C_D(tableId, columnId, data, 0, 1, obc);
2666
2667        if (list.isEmpty()) {
2668            StringBundler msg = new StringBundler(8);
2669
2670            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2671
2672            msg.append("tableId=");
2673            msg.append(tableId);
2674
2675            msg.append(", columnId=");
2676            msg.append(columnId);
2677
2678            msg.append(", data=");
2679            msg.append(data);
2680
2681            msg.append(StringPool.CLOSE_CURLY_BRACE);
2682
2683            throw new NoSuchValueException(msg.toString());
2684        }
2685        else {
2686            return list.get(0);
2687        }
2688    }
2689
2690    public ExpandoValue findByT_C_D_Last(long tableId, long columnId,
2691        String data, OrderByComparator obc)
2692        throws NoSuchValueException, SystemException {
2693        int count = countByT_C_D(tableId, columnId, data);
2694
2695        List<ExpandoValue> list = findByT_C_D(tableId, columnId, data,
2696                count - 1, count, obc);
2697
2698        if (list.isEmpty()) {
2699            StringBundler msg = new StringBundler(8);
2700
2701            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2702
2703            msg.append("tableId=");
2704            msg.append(tableId);
2705
2706            msg.append(", columnId=");
2707            msg.append(columnId);
2708
2709            msg.append(", data=");
2710            msg.append(data);
2711
2712            msg.append(StringPool.CLOSE_CURLY_BRACE);
2713
2714            throw new NoSuchValueException(msg.toString());
2715        }
2716        else {
2717            return list.get(0);
2718        }
2719    }
2720
2721    public ExpandoValue[] findByT_C_D_PrevAndNext(long valueId, long tableId,
2722        long columnId, String data, OrderByComparator obc)
2723        throws NoSuchValueException, SystemException {
2724        ExpandoValue expandoValue = findByPrimaryKey(valueId);
2725
2726        int count = countByT_C_D(tableId, columnId, data);
2727
2728        Session session = null;
2729
2730        try {
2731            session = openSession();
2732
2733            StringBundler query = null;
2734
2735            if (obc != null) {
2736                query = new StringBundler(5 +
2737                        (obc.getOrderByFields().length * 3));
2738            }
2739            else {
2740                query = new StringBundler(5);
2741            }
2742
2743            query.append(_SQL_SELECT_EXPANDOVALUE_WHERE);
2744
2745            query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
2746
2747            query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
2748
2749            if (data == null) {
2750                query.append(_FINDER_COLUMN_T_C_D_DATA_1);
2751            }
2752            else {
2753                if (data.equals(StringPool.BLANK)) {
2754                    query.append(_FINDER_COLUMN_T_C_D_DATA_3);
2755                }
2756                else {
2757                    query.append(_FINDER_COLUMN_T_C_D_DATA_2);
2758                }
2759            }
2760
2761            if (obc != null) {
2762                appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2763            }
2764
2765            else {
2766                query.append(ExpandoValueModelImpl.ORDER_BY_JPQL);
2767            }
2768
2769            String sql = query.toString();
2770
2771            Query q = session.createQuery(sql);
2772
2773            QueryPos qPos = QueryPos.getInstance(q);
2774
2775            qPos.add(tableId);
2776
2777            qPos.add(columnId);
2778
2779            if (data != null) {
2780                qPos.add(data);
2781            }
2782
2783            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2784                    expandoValue);
2785
2786            ExpandoValue[] array = new ExpandoValueImpl[3];
2787
2788            array[0] = (ExpandoValue)objArray[0];
2789            array[1] = (ExpandoValue)objArray[1];
2790            array[2] = (ExpandoValue)objArray[2];
2791
2792            return array;
2793        }
2794        catch (Exception e) {
2795            throw processException(e);
2796        }
2797        finally {
2798            closeSession(session);
2799        }
2800    }
2801
2802    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
2803        throws SystemException {
2804        Session session = null;
2805
2806        try {
2807            session = openSession();
2808
2809            dynamicQuery.compile(session);
2810
2811            return dynamicQuery.list();
2812        }
2813        catch (Exception e) {
2814            throw processException(e);
2815        }
2816        finally {
2817            closeSession(session);
2818        }
2819    }
2820
2821    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
2822        int start, int end) throws SystemException {
2823        Session session = null;
2824
2825        try {
2826            session = openSession();
2827
2828            dynamicQuery.setLimit(start, end);
2829
2830            dynamicQuery.compile(session);
2831
2832            return dynamicQuery.list();
2833        }
2834        catch (Exception e) {
2835            throw processException(e);
2836        }
2837        finally {
2838            closeSession(session);
2839        }
2840    }
2841
2842    public List<ExpandoValue> findAll() throws SystemException {
2843        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2844    }
2845
2846    public List<ExpandoValue> findAll(int start, int end)
2847        throws SystemException {
2848        return findAll(start, end, null);
2849    }
2850
2851    public List<ExpandoValue> findAll(int start, int end, OrderByComparator obc)
2852        throws SystemException {
2853        Object[] finderArgs = new Object[] {
2854                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2855            };
2856
2857        List<ExpandoValue> list = (List<ExpandoValue>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2858                finderArgs, this);
2859
2860        if (list == null) {
2861            Session session = null;
2862
2863            try {
2864                session = openSession();
2865
2866                StringBundler query = null;
2867                String sql = null;
2868
2869                if (obc != null) {
2870                    query = new StringBundler(2 +
2871                            (obc.getOrderByFields().length * 3));
2872
2873                    query.append(_SQL_SELECT_EXPANDOVALUE);
2874
2875                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, obc);
2876
2877                    sql = query.toString();
2878                }
2879
2880                else {
2881                    sql = _SQL_SELECT_EXPANDOVALUE.concat(ExpandoValueModelImpl.ORDER_BY_JPQL);
2882                }
2883
2884                Query q = session.createQuery(sql);
2885
2886                if (obc == null) {
2887                    list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2888                            start, end, false);
2889
2890                    Collections.sort(list);
2891                }
2892                else {
2893                    list = (List<ExpandoValue>)QueryUtil.list(q, getDialect(),
2894                            start, end);
2895                }
2896            }
2897            catch (Exception e) {
2898                throw processException(e);
2899            }
2900            finally {
2901                if (list == null) {
2902                    list = new ArrayList<ExpandoValue>();
2903                }
2904
2905                cacheResult(list);
2906
2907                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2908
2909                closeSession(session);
2910            }
2911        }
2912
2913        return list;
2914    }
2915
2916    public void removeByTableId(long tableId) throws SystemException {
2917        for (ExpandoValue expandoValue : findByTableId(tableId)) {
2918            remove(expandoValue);
2919        }
2920    }
2921
2922    public void removeByColumnId(long columnId) throws SystemException {
2923        for (ExpandoValue expandoValue : findByColumnId(columnId)) {
2924            remove(expandoValue);
2925        }
2926    }
2927
2928    public void removeByRowId(long rowId) throws SystemException {
2929        for (ExpandoValue expandoValue : findByRowId(rowId)) {
2930            remove(expandoValue);
2931        }
2932    }
2933
2934    public void removeByT_C(long tableId, long columnId)
2935        throws SystemException {
2936        for (ExpandoValue expandoValue : findByT_C(tableId, columnId)) {
2937            remove(expandoValue);
2938        }
2939    }
2940
2941    public void removeByT_CPK(long tableId, long classPK)
2942        throws SystemException {
2943        for (ExpandoValue expandoValue : findByT_CPK(tableId, classPK)) {
2944            remove(expandoValue);
2945        }
2946    }
2947
2948    public void removeByT_R(long tableId, long rowId) throws SystemException {
2949        for (ExpandoValue expandoValue : findByT_R(tableId, rowId)) {
2950            remove(expandoValue);
2951        }
2952    }
2953
2954    public void removeByC_R(long columnId, long rowId)
2955        throws NoSuchValueException, SystemException {
2956        ExpandoValue expandoValue = findByC_R(columnId, rowId);
2957
2958        remove(expandoValue);
2959    }
2960
2961    public void removeByC_C(long classNameId, long classPK)
2962        throws SystemException {
2963        for (ExpandoValue expandoValue : findByC_C(classNameId, classPK)) {
2964            remove(expandoValue);
2965        }
2966    }
2967
2968    public void removeByT_C_C(long tableId, long columnId, long classPK)
2969        throws NoSuchValueException, SystemException {
2970        ExpandoValue expandoValue = findByT_C_C(tableId, columnId, classPK);
2971
2972        remove(expandoValue);
2973    }
2974
2975    public void removeByT_C_D(long tableId, long columnId, String data)
2976        throws SystemException {
2977        for (ExpandoValue expandoValue : findByT_C_D(tableId, columnId, data)) {
2978            remove(expandoValue);
2979        }
2980    }
2981
2982    public void removeAll() throws SystemException {
2983        for (ExpandoValue expandoValue : findAll()) {
2984            remove(expandoValue);
2985        }
2986    }
2987
2988    public int countByTableId(long tableId) throws SystemException {
2989        Object[] finderArgs = new Object[] { new Long(tableId) };
2990
2991        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TABLEID,
2992                finderArgs, this);
2993
2994        if (count == null) {
2995            Session session = null;
2996
2997            try {
2998                session = openSession();
2999
3000                StringBundler query = new StringBundler(2);
3001
3002                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3003
3004                query.append(_FINDER_COLUMN_TABLEID_TABLEID_2);
3005
3006                String sql = query.toString();
3007
3008                Query q = session.createQuery(sql);
3009
3010                QueryPos qPos = QueryPos.getInstance(q);
3011
3012                qPos.add(tableId);
3013
3014                count = (Long)q.uniqueResult();
3015            }
3016            catch (Exception e) {
3017                throw processException(e);
3018            }
3019            finally {
3020                if (count == null) {
3021                    count = Long.valueOf(0);
3022                }
3023
3024                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TABLEID,
3025                    finderArgs, count);
3026
3027                closeSession(session);
3028            }
3029        }
3030
3031        return count.intValue();
3032    }
3033
3034    public int countByColumnId(long columnId) throws SystemException {
3035        Object[] finderArgs = new Object[] { new Long(columnId) };
3036
3037        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COLUMNID,
3038                finderArgs, this);
3039
3040        if (count == null) {
3041            Session session = null;
3042
3043            try {
3044                session = openSession();
3045
3046                StringBundler query = new StringBundler(2);
3047
3048                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3049
3050                query.append(_FINDER_COLUMN_COLUMNID_COLUMNID_2);
3051
3052                String sql = query.toString();
3053
3054                Query q = session.createQuery(sql);
3055
3056                QueryPos qPos = QueryPos.getInstance(q);
3057
3058                qPos.add(columnId);
3059
3060                count = (Long)q.uniqueResult();
3061            }
3062            catch (Exception e) {
3063                throw processException(e);
3064            }
3065            finally {
3066                if (count == null) {
3067                    count = Long.valueOf(0);
3068                }
3069
3070                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COLUMNID,
3071                    finderArgs, count);
3072
3073                closeSession(session);
3074            }
3075        }
3076
3077        return count.intValue();
3078    }
3079
3080    public int countByRowId(long rowId) throws SystemException {
3081        Object[] finderArgs = new Object[] { new Long(rowId) };
3082
3083        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ROWID,
3084                finderArgs, this);
3085
3086        if (count == null) {
3087            Session session = null;
3088
3089            try {
3090                session = openSession();
3091
3092                StringBundler query = new StringBundler(2);
3093
3094                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3095
3096                query.append(_FINDER_COLUMN_ROWID_ROWID_2);
3097
3098                String sql = query.toString();
3099
3100                Query q = session.createQuery(sql);
3101
3102                QueryPos qPos = QueryPos.getInstance(q);
3103
3104                qPos.add(rowId);
3105
3106                count = (Long)q.uniqueResult();
3107            }
3108            catch (Exception e) {
3109                throw processException(e);
3110            }
3111            finally {
3112                if (count == null) {
3113                    count = Long.valueOf(0);
3114                }
3115
3116                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ROWID,
3117                    finderArgs, count);
3118
3119                closeSession(session);
3120            }
3121        }
3122
3123        return count.intValue();
3124    }
3125
3126    public int countByT_C(long tableId, long columnId)
3127        throws SystemException {
3128        Object[] finderArgs = new Object[] { new Long(tableId), new Long(columnId) };
3129
3130        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C,
3131                finderArgs, this);
3132
3133        if (count == null) {
3134            Session session = null;
3135
3136            try {
3137                session = openSession();
3138
3139                StringBundler query = new StringBundler(3);
3140
3141                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3142
3143                query.append(_FINDER_COLUMN_T_C_TABLEID_2);
3144
3145                query.append(_FINDER_COLUMN_T_C_COLUMNID_2);
3146
3147                String sql = query.toString();
3148
3149                Query q = session.createQuery(sql);
3150
3151                QueryPos qPos = QueryPos.getInstance(q);
3152
3153                qPos.add(tableId);
3154
3155                qPos.add(columnId);
3156
3157                count = (Long)q.uniqueResult();
3158            }
3159            catch (Exception e) {
3160                throw processException(e);
3161            }
3162            finally {
3163                if (count == null) {
3164                    count = Long.valueOf(0);
3165                }
3166
3167                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C, finderArgs,
3168                    count);
3169
3170                closeSession(session);
3171            }
3172        }
3173
3174        return count.intValue();
3175    }
3176
3177    public int countByT_CPK(long tableId, long classPK)
3178        throws SystemException {
3179        Object[] finderArgs = new Object[] { new Long(tableId), new Long(classPK) };
3180
3181        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_CPK,
3182                finderArgs, this);
3183
3184        if (count == null) {
3185            Session session = null;
3186
3187            try {
3188                session = openSession();
3189
3190                StringBundler query = new StringBundler(3);
3191
3192                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3193
3194                query.append(_FINDER_COLUMN_T_CPK_TABLEID_2);
3195
3196                query.append(_FINDER_COLUMN_T_CPK_CLASSPK_2);
3197
3198                String sql = query.toString();
3199
3200                Query q = session.createQuery(sql);
3201
3202                QueryPos qPos = QueryPos.getInstance(q);
3203
3204                qPos.add(tableId);
3205
3206                qPos.add(classPK);
3207
3208                count = (Long)q.uniqueResult();
3209            }
3210            catch (Exception e) {
3211                throw processException(e);
3212            }
3213            finally {
3214                if (count == null) {
3215                    count = Long.valueOf(0);
3216                }
3217
3218                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_CPK,
3219                    finderArgs, count);
3220
3221                closeSession(session);
3222            }
3223        }
3224
3225        return count.intValue();
3226    }
3227
3228    public int countByT_R(long tableId, long rowId) throws SystemException {
3229        Object[] finderArgs = new Object[] { new Long(tableId), new Long(rowId) };
3230
3231        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_R,
3232                finderArgs, this);
3233
3234        if (count == null) {
3235            Session session = null;
3236
3237            try {
3238                session = openSession();
3239
3240                StringBundler query = new StringBundler(3);
3241
3242                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3243
3244                query.append(_FINDER_COLUMN_T_R_TABLEID_2);
3245
3246                query.append(_FINDER_COLUMN_T_R_ROWID_2);
3247
3248                String sql = query.toString();
3249
3250                Query q = session.createQuery(sql);
3251
3252                QueryPos qPos = QueryPos.getInstance(q);
3253
3254                qPos.add(tableId);
3255
3256                qPos.add(rowId);
3257
3258                count = (Long)q.uniqueResult();
3259            }
3260            catch (Exception e) {
3261                throw processException(e);
3262            }
3263            finally {
3264                if (count == null) {
3265                    count = Long.valueOf(0);
3266                }
3267
3268                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_R, finderArgs,
3269                    count);
3270
3271                closeSession(session);
3272            }
3273        }
3274
3275        return count.intValue();
3276    }
3277
3278    public int countByC_R(long columnId, long rowId) throws SystemException {
3279        Object[] finderArgs = new Object[] { new Long(columnId), new Long(rowId) };
3280
3281        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_R,
3282                finderArgs, this);
3283
3284        if (count == null) {
3285            Session session = null;
3286
3287            try {
3288                session = openSession();
3289
3290                StringBundler query = new StringBundler(3);
3291
3292                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3293
3294                query.append(_FINDER_COLUMN_C_R_COLUMNID_2);
3295
3296                query.append(_FINDER_COLUMN_C_R_ROWID_2);
3297
3298                String sql = query.toString();
3299
3300                Query q = session.createQuery(sql);
3301
3302                QueryPos qPos = QueryPos.getInstance(q);
3303
3304                qPos.add(columnId);
3305
3306                qPos.add(rowId);
3307
3308                count = (Long)q.uniqueResult();
3309            }
3310            catch (Exception e) {
3311                throw processException(e);
3312            }
3313            finally {
3314                if (count == null) {
3315                    count = Long.valueOf(0);
3316                }
3317
3318                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_R, finderArgs,
3319                    count);
3320
3321                closeSession(session);
3322            }
3323        }
3324
3325        return count.intValue();
3326    }
3327
3328    public int countByC_C(long classNameId, long classPK)
3329        throws SystemException {
3330        Object[] finderArgs = new Object[] {
3331                new Long(classNameId), new Long(classPK)
3332            };
3333
3334        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
3335                finderArgs, this);
3336
3337        if (count == null) {
3338            Session session = null;
3339
3340            try {
3341                session = openSession();
3342
3343                StringBundler query = new StringBundler(3);
3344
3345                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3346
3347                query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3348
3349                query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3350
3351                String sql = query.toString();
3352
3353                Query q = session.createQuery(sql);
3354
3355                QueryPos qPos = QueryPos.getInstance(q);
3356
3357                qPos.add(classNameId);
3358
3359                qPos.add(classPK);
3360
3361                count = (Long)q.uniqueResult();
3362            }
3363            catch (Exception e) {
3364                throw processException(e);
3365            }
3366            finally {
3367                if (count == null) {
3368                    count = Long.valueOf(0);
3369                }
3370
3371                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
3372                    count);
3373
3374                closeSession(session);
3375            }
3376        }
3377
3378        return count.intValue();
3379    }
3380
3381    public int countByT_C_C(long tableId, long columnId, long classPK)
3382        throws SystemException {
3383        Object[] finderArgs = new Object[] {
3384                new Long(tableId), new Long(columnId), new Long(classPK)
3385            };
3386
3387        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C_C,
3388                finderArgs, this);
3389
3390        if (count == null) {
3391            Session session = null;
3392
3393            try {
3394                session = openSession();
3395
3396                StringBundler query = new StringBundler(4);
3397
3398                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3399
3400                query.append(_FINDER_COLUMN_T_C_C_TABLEID_2);
3401
3402                query.append(_FINDER_COLUMN_T_C_C_COLUMNID_2);
3403
3404                query.append(_FINDER_COLUMN_T_C_C_CLASSPK_2);
3405
3406                String sql = query.toString();
3407
3408                Query q = session.createQuery(sql);
3409
3410                QueryPos qPos = QueryPos.getInstance(q);
3411
3412                qPos.add(tableId);
3413
3414                qPos.add(columnId);
3415
3416                qPos.add(classPK);
3417
3418                count = (Long)q.uniqueResult();
3419            }
3420            catch (Exception e) {
3421                throw processException(e);
3422            }
3423            finally {
3424                if (count == null) {
3425                    count = Long.valueOf(0);
3426                }
3427
3428                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C_C,
3429                    finderArgs, count);
3430
3431                closeSession(session);
3432            }
3433        }
3434
3435        return count.intValue();
3436    }
3437
3438    public int countByT_C_D(long tableId, long columnId, String data)
3439        throws SystemException {
3440        Object[] finderArgs = new Object[] {
3441                new Long(tableId), new Long(columnId),
3442                
3443                data
3444            };
3445
3446        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_T_C_D,
3447                finderArgs, this);
3448
3449        if (count == null) {
3450            Session session = null;
3451
3452            try {
3453                session = openSession();
3454
3455                StringBundler query = new StringBundler(4);
3456
3457                query.append(_SQL_COUNT_EXPANDOVALUE_WHERE);
3458
3459                query.append(_FINDER_COLUMN_T_C_D_TABLEID_2);
3460
3461                query.append(_FINDER_COLUMN_T_C_D_COLUMNID_2);
3462
3463                if (data == null) {
3464                    query.append(_FINDER_COLUMN_T_C_D_DATA_1);
3465                }
3466                else {
3467                    if (data.equals(StringPool.BLANK)) {
3468                        query.append(_FINDER_COLUMN_T_C_D_DATA_3);
3469                    }
3470                    else {
3471                        query.append(_FINDER_COLUMN_T_C_D_DATA_2);
3472                    }
3473                }
3474
3475                String sql = query.toString();
3476
3477                Query q = session.createQuery(sql);
3478
3479                QueryPos qPos = QueryPos.getInstance(q);
3480
3481                qPos.add(tableId);
3482
3483                qPos.add(columnId);
3484
3485                if (data != null) {
3486                    qPos.add(data);
3487                }
3488
3489                count = (Long)q.uniqueResult();
3490            }
3491            catch (Exception e) {
3492                throw processException(e);
3493            }
3494            finally {
3495                if (count == null) {
3496                    count = Long.valueOf(0);
3497                }
3498
3499                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_T_C_D,
3500                    finderArgs, count);
3501
3502                closeSession(session);
3503            }
3504        }
3505
3506        return count.intValue();
3507    }
3508
3509    public int countAll() throws SystemException {
3510        Object[] finderArgs = new Object[0];
3511
3512        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3513                finderArgs, this);
3514
3515        if (count == null) {
3516            Session session = null;
3517
3518            try {
3519                session = openSession();
3520
3521                Query q = session.createQuery(_SQL_COUNT_EXPANDOVALUE);
3522
3523                count = (Long)q.uniqueResult();
3524            }
3525            catch (Exception e) {
3526                throw processException(e);
3527            }
3528            finally {
3529                if (count == null) {
3530                    count = Long.valueOf(0);
3531                }
3532
3533                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3534                    count);
3535
3536                closeSession(session);
3537            }
3538        }
3539
3540        return count.intValue();
3541    }
3542
3543    public void afterPropertiesSet() {
3544        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3545                    com.liferay.portal.util.PropsUtil.get(
3546                        "value.object.listener.com.liferay.portlet.expando.model.ExpandoValue")));
3547
3548        if (listenerClassNames.length > 0) {
3549            try {
3550                List<ModelListener<ExpandoValue>> listenersList = new ArrayList<ModelListener<ExpandoValue>>();
3551
3552                for (String listenerClassName : listenerClassNames) {
3553                    listenersList.add((ModelListener<ExpandoValue>)Class.forName(
3554                            listenerClassName).newInstance());
3555                }
3556
3557                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3558            }
3559            catch (Exception e) {
3560                _log.error(e);
3561            }
3562        }
3563    }
3564
3565    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence")
3566    protected com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence expandoColumnPersistence;
3567    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence")
3568    protected com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence expandoRowPersistence;
3569    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence")
3570    protected com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence expandoTablePersistence;
3571    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence")
3572    protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
3573    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence")
3574    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
3575    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence")
3576    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
3577    private static final String _SQL_SELECT_EXPANDOVALUE = "SELECT expandoValue FROM ExpandoValue expandoValue";
3578    private static final String _SQL_SELECT_EXPANDOVALUE_WHERE = "SELECT expandoValue FROM ExpandoValue expandoValue WHERE ";
3579    private static final String _SQL_COUNT_EXPANDOVALUE = "SELECT COUNT(expandoValue) FROM ExpandoValue expandoValue";
3580    private static final String _SQL_COUNT_EXPANDOVALUE_WHERE = "SELECT COUNT(expandoValue) FROM ExpandoValue expandoValue WHERE ";
3581    private static final String _FINDER_COLUMN_TABLEID_TABLEID_2 = "expandoValue.tableId = ?";
3582    private static final String _FINDER_COLUMN_COLUMNID_COLUMNID_2 = "expandoValue.columnId = ?";
3583    private static final String _FINDER_COLUMN_ROWID_ROWID_2 = "expandoValue.rowId = ?";
3584    private static final String _FINDER_COLUMN_T_C_TABLEID_2 = "expandoValue.tableId = ? AND ";
3585    private static final String _FINDER_COLUMN_T_C_COLUMNID_2 = "expandoValue.columnId = ?";
3586    private static final String _FINDER_COLUMN_T_CPK_TABLEID_2 = "expandoValue.tableId = ? AND ";
3587    private static final String _FINDER_COLUMN_T_CPK_CLASSPK_2 = "expandoValue.classPK = ?";
3588    private static final String _FINDER_COLUMN_T_R_TABLEID_2 = "expandoValue.tableId = ? AND ";
3589    private static final String _FINDER_COLUMN_T_R_ROWID_2 = "expandoValue.rowId = ?";
3590    private static final String _FINDER_COLUMN_C_R_COLUMNID_2 = "expandoValue.columnId = ? AND ";
3591    private static final String _FINDER_COLUMN_C_R_ROWID_2 = "expandoValue.rowId = ?";
3592    private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "expandoValue.classNameId = ? AND ";
3593    private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "expandoValue.classPK = ?";
3594    private static final String _FINDER_COLUMN_T_C_C_TABLEID_2 = "expandoValue.tableId = ? AND ";
3595    private static final String _FINDER_COLUMN_T_C_C_COLUMNID_2 = "expandoValue.columnId = ? AND ";
3596    private static final String _FINDER_COLUMN_T_C_C_CLASSPK_2 = "expandoValue.classPK = ?";
3597    private static final String _FINDER_COLUMN_T_C_D_TABLEID_2 = "expandoValue.tableId = ? AND ";
3598    private static final String _FINDER_COLUMN_T_C_D_COLUMNID_2 = "expandoValue.columnId = ? AND ";
3599    private static final String _FINDER_COLUMN_T_C_D_DATA_1 = "expandoValue.data IS NULL";
3600    private static final String _FINDER_COLUMN_T_C_D_DATA_2 = "expandoValue.data = ?";
3601    private static final String _FINDER_COLUMN_T_C_D_DATA_3 = "(expandoValue.data IS NULL OR expandoValue.data = ?)";
3602    private static final String _ORDER_BY_ENTITY_ALIAS = "expandoValue.";
3603    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExpandoValue exists with the primary key ";
3604    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExpandoValue exists with the key {";
3605    private static Log _log = LogFactoryUtil.getLog(ExpandoValuePersistenceImpl.class);
3606}