01: /**********************************************************************
02: Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: 2003 Andy Jefferson - coding standards
18: ...
19: **********************************************************************/package org.jpox.store.query;
20:
21: import org.jpox.store.DatastoreIdentifier;
22: import org.jpox.store.expression.QueryExpression;
23:
24: /**
25: * Indicates an object that can be queried, such as an Extent or persistent collection.
26: *
27: * @version $Revision: 1.8 $
28: */
29: public interface Queryable {
30: /**
31: * Returns a proto-typical query statement over the underlying collection.
32: * <p>
33: * The returned query statement selects all applicable rows from the
34: * relevant base table(s) and the column that represents the element or element ID.
35: * The statement can then be modified to join additional tables, select more columns, add WHERE conditions, etc.
36: * @return The new prototypical query statement.
37: */
38: QueryExpression newQueryStatement();
39:
40: /**
41: * Returns a prototypical query statement over the underlying collection,
42: * pre-filtered to include only objects of the specified class.
43: *
44: * @param candidateClass Candidate class
45: * @param candidateAlias Alias to use for the candidate in the query (if the native query supports it)
46: * @return The new prototypical query statement.
47: * @exception org.jpox.exceptions.JPOXUserException If <var>candidateClass</var> is not the same as
48: * or a subclass of the defined element type for this collection.
49: */
50: QueryExpression newQueryStatement(Class candidateClass,
51: DatastoreIdentifier candidateAlias);
52:
53: /**
54: * Returns a suitable query result factory for results produced by the specified query.
55: * <p>
56: * The <var>stmt</var> argument must have been obtained by a previous call
57: * to newQueryStatement() on the same Queryable.
58: * @param stmt The query statement
59: * @param ignoreCache Whether to ignore the cache
60: * @param resultClass Create objects of a particular type
61: * @param useFetchPlan whether to use the fetch plan to retrieve fields in the same query
62: * @return A factory for creating PersistenceCapable objects from query results.
63: */
64: ResultObjectFactory newResultObjectFactory(QueryExpression stmt,
65: boolean ignoreCache, Class resultClass, boolean useFetchPlan);
66:
67: /**
68: * Returns <tt>true</tt> if this collection contains no elements.<p>
69: * @return <tt>true</tt> if this collection contains no elements.
70: */
71: boolean isEmpty();
72: }
|