01: //$Id: CustomQuery.java 10018 2006-06-15 05:21:06Z steve.ebersole@jboss.com $
02: package org.hibernate.loader.custom;
03:
04: import java.util.Map;
05: import java.util.Set;
06: import java.util.List;
07:
08: /**
09: * Extension point allowing any SQL query with named and positional parameters
10: * to be executed by Hibernate, returning managed entities, collections and
11: * simple scalar values.
12: *
13: * @author Gavin King
14: * @author Steve Ebersole
15: */
16: public interface CustomQuery {
17: /**
18: * The SQL query string to be performed.
19: *
20: * @return The SQL statement string.
21: */
22: public String getSQL();
23:
24: /**
25: * Any query spaces to apply to the query execution. Query spaces are
26: * used in Hibernate's auto-flushing mechanism to determine which
27: * entities need to be checked for pending changes.
28: *
29: * @return The query spaces
30: */
31: public Set getQuerySpaces();
32:
33: /**
34: * A map representing positions within the supplied {@link #getSQL query} to
35: * which we need to bind named parameters.
36: * <p/>
37: * Optional, may return null if no named parameters.
38: * <p/>
39: * The structure of the returned map (if one) as follows:<ol>
40: * <li>The keys into the map are the named parameter names</li>
41: * <li>The corresponding value is either an {@link Integer} if the
42: * parameter occurs only once in the query; or a List of Integers if the
43: * parameter occurs more than once</li>
44: * </ol>
45: */
46: public Map getNamedParameterBindPoints();
47:
48: /**
49: * A collection of {@link Return descriptors} describing the
50: * JDBC result set to be expected and how to map this result set.
51: *
52: * @return List of return descriptors.
53: */
54: public List getCustomQueryReturns();
55: }
|