001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package javax.persistence;
031:
032: import java.util.Calendar;
033: import java.util.Date;
034: import java.util.List;
035:
036: /**
037: * The main application interface to the persistence context.
038: */
039: public interface Query {
040: /**
041: * Executes a SELECT and return the results as a list.
042: */
043: public List getResultList();
044:
045: /**
046: * Returns the single result of a query.
047: */
048: public Object getSingleResult();
049:
050: /**
051: * An update or delete query.
052: */
053: public int executeUpdate();
054:
055: /**
056: * Sets the maximum number of results to retrieve.
057: */
058: public Query setMaxResults(int maxResult);
059:
060: /**
061: * Sets the first result.
062: */
063: public Query setFirstResult(int startPosition);
064:
065: /**
066: * Sets an implementation-specific hint.
067: */
068: public Query setHint(String hintName, Object value);
069:
070: /**
071: * Binds a named parameter.
072: */
073: public Query setParameter(String name, Object value);
074:
075: /**
076: * Sets a date parameter.
077: */
078: public Query setParameter(String name, Date date, TemporalType type);
079:
080: /**
081: * Sets a calendar parameter.
082: */
083: public Query setParameter(String name, Calendar date,
084: TemporalType type);
085:
086: /**
087: * Binds a position parameter.
088: */
089: public Query setParameter(int pos, Object value);
090:
091: /**
092: * Sets a date parameter.
093: */
094: public Query setParameter(int pos, Date date, TemporalType type);
095:
096: /**
097: * Sets a calendar parameter.
098: */
099: public Query setParameter(int pos, Calendar date, TemporalType type);
100:
101: /**
102: * Sets the flush type.
103: */
104: public Query setFlushMode(FlushModeType flushMode);
105:
106: }
|