01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.entity;
08:
09: import java.util.Calendar;
10: import java.util.Date;
11: import java.util.List;
12: import javax.persistence.FlushModeType;
13: import javax.persistence.Query;
14: import javax.persistence.TemporalType;
15:
16: /**
17: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
18: */
19: public abstract class QueryExt implements Query {
20:
21: protected int startPosition = 0;
22: protected int maxResult = Integer.MAX_VALUE;
23:
24: public abstract String getName();
25:
26: public abstract int executeUpdate();
27:
28: public abstract List<?> getResultList();
29:
30: public abstract Object getSingleResult();
31:
32: public abstract Query setParameter(String name, Object value);
33:
34: public Query setFirstResult(int startPosition) {
35: if (startPosition > 0) {
36: this .startPosition = startPosition;
37: }
38: return this ;
39: }
40:
41: public Query setMaxResults(int maxResult) {
42: if (maxResult > 0) {
43: this .maxResult = maxResult;
44: }
45: return this ;
46: }
47:
48: public int getFirstResult() {
49: return startPosition;
50: }
51:
52: public int getMaxResult() {
53: return maxResult;
54: }
55:
56: public Query setFlushMode(FlushModeType flushMode) {
57: return null;
58: }
59:
60: public Query setHint(String hintName, Object value) {
61: throw new UnsupportedOperationException(
62: "Query.setHint(String hintName, Object value)");
63: }
64:
65: public Query setParameter(String name, Calendar value,
66: TemporalType temporalType) {
67: throw new UnsupportedOperationException(
68: "Query.setParameter(String name, Calendar value, TemporalType temporalType)");
69: }
70:
71: public Query setParameter(String name, Date value,
72: TemporalType temporalType) {
73: throw new UnsupportedOperationException(
74: "Query.setParameter(String name, Date value, TemporalType temporalType)");
75: }
76:
77: public Query setParameter(int position, Calendar value,
78: TemporalType temporalType) {
79: throw new UnsupportedOperationException(
80: "Query.setParameter(int position, Calendar value, TemporalType temporalType)");
81: }
82:
83: public Query setParameter(int position, Date value,
84: TemporalType temporalType) {
85: throw new UnsupportedOperationException(
86: "Query.setParameter(int position, Date value, TemporalType temporalType)");
87: }
88:
89: public Query setParameter(int position, Object value) {
90: throw new UnsupportedOperationException(
91: "Query.setParameter(int position, Object value)");
92: }
93:
94: public static void main(String[] args) {
95:
96: }
97: }
|