01: //$Id: NamedQueryDefinition.java 7966 2005-08-19 23:40:24Z epbernard $
02: package org.hibernate.engine;
03:
04: import java.io.Serializable;
05: import java.util.Map;
06:
07: import org.hibernate.CacheMode;
08: import org.hibernate.FlushMode;
09:
10: /**
11: * Definition of a named query, defined in the mapping metadata.
12: *
13: * @author Gavin King
14: */
15: public class NamedQueryDefinition implements Serializable {
16: private final String query;
17: private final boolean cacheable;
18: private final String cacheRegion;
19: private final Integer timeout;
20: private final Integer fetchSize;
21: private final FlushMode flushMode;
22: private final Map parameterTypes;
23: private CacheMode cacheMode;
24: private boolean readOnly;
25: private String comment;
26:
27: // kept for backward compatibility until after the 3.1beta5 release of HA
28: public NamedQueryDefinition(String query, boolean cacheable,
29: String cacheRegion, Integer timeout, Integer fetchSize,
30: FlushMode flushMode, Map parameterTypes) {
31: this (query, cacheable, cacheRegion, timeout, fetchSize,
32: flushMode, null, false, null, parameterTypes);
33: }
34:
35: public NamedQueryDefinition(String query, boolean cacheable,
36: String cacheRegion, Integer timeout, Integer fetchSize,
37: FlushMode flushMode, CacheMode cacheMode, boolean readOnly,
38: String comment, Map parameterTypes) {
39: this .query = query;
40: this .cacheable = cacheable;
41: this .cacheRegion = cacheRegion;
42: this .timeout = timeout;
43: this .fetchSize = fetchSize;
44: this .flushMode = flushMode;
45: this .parameterTypes = parameterTypes;
46: this .cacheMode = cacheMode;
47: this .readOnly = readOnly;
48: this .comment = comment;
49: }
50:
51: public String getQueryString() {
52: return query;
53: }
54:
55: public boolean isCacheable() {
56: return cacheable;
57: }
58:
59: public String getCacheRegion() {
60: return cacheRegion;
61: }
62:
63: public Integer getFetchSize() {
64: return fetchSize;
65: }
66:
67: public Integer getTimeout() {
68: return timeout;
69: }
70:
71: public FlushMode getFlushMode() {
72: return flushMode;
73: }
74:
75: public String toString() {
76: return getClass().getName() + '(' + query + ')';
77: }
78:
79: public Map getParameterTypes() {
80: return parameterTypes;
81: }
82:
83: public String getQuery() {
84: return query;
85: }
86:
87: public CacheMode getCacheMode() {
88: return cacheMode;
89: }
90:
91: public boolean isReadOnly() {
92: return readOnly;
93: }
94:
95: public String getComment() {
96: return comment;
97: }
98: }
|