01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency;
10:
11: import java.util.Collection;
12:
13: /**
14: * It is created for "quick-and-dirty" selects.
15: * It does not require transactions openning and committing.
16: * It does it internally.
17: *
18: * @author Gennady Krizhevsky
19: */
20: public interface QuickPersistency {
21:
22: /**
23: * Returns QueryFactory
24: *
25: * @return QueryFactory
26: */
27: QueryFactory getQueryFactory();
28:
29: /**
30: * Returns SelectQueryBuilder
31: *
32: * @return SelectQueryBuilder
33: */
34: SelectQueryBuilder getSelectQueryBuilder();
35:
36: //
37: // Quick persistency implementation
38: //
39: /**
40: * Retrieves collection of persistent objects "by query".
41: * Query controls the type of collection and objects to return.
42: * Collection is never null. If nothing found the one with 0-length is returned.
43: *
44: * @see Query
45: * @param query
46: * @return Collection of persistent objects - never null. If nothing found the one with 0-length is returned.
47: * @throws OdalPersistencyException
48: */
49: Collection quickSelect(Query query) throws OdalPersistencyException;
50:
51: /**
52: * Method will use query object to build exists sql statement.
53: * Concrete implementation may reject query in case sql string is set
54: * externally.
55: *
56: * @param query
57: * @return true if query returns any results
58: * @throws OdalPersistencyException
59: */
60: boolean quickSelectExists(Query query)
61: throws OdalPersistencyException;
62:
63: /**
64: * Method will use query object to build "select count(*)" statement.
65: * Concrete implementation may reject query in case sql string is set
66: * externally.
67: *
68: * @param query
69: * @return count
70: * @throws OdalPersistencyException
71: */
72: long quickSelectCount(Query query) throws OdalPersistencyException;
73:
74: /**
75: * Retrieves collection of persistent objects "by query" and returns the 1st object.
76: *
77: * @param query
78: * @return 1st object or null if nothing found
79: * @throws OdalPersistencyException
80: */
81: Object quickSelectFirst(Query query)
82: throws OdalPersistencyException;
83:
84: /**
85: * Method can be used for queries that return single value results
86: *
87: * @param query
88: * @return single value
89: * @throws OdalPersistencyException
90: */
91: Object quickSelectSingle(Query query)
92: throws OdalPersistencyException;
93: }
|