Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JdbcAccess |
|
| 1.0;1 |
1 | package org.apache.ojb.broker.accesslayer; | |
2 | ||
3 | /* Copyright 2002-2005 The Apache Software Foundation | |
4 | * | |
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | import org.apache.ojb.broker.Identity; | |
19 | import org.apache.ojb.broker.PersistenceBrokerException; | |
20 | import org.apache.ojb.broker.core.ValueContainer; | |
21 | import org.apache.ojb.broker.metadata.ClassDescriptor; | |
22 | import org.apache.ojb.broker.query.Query; | |
23 | ||
24 | /** | |
25 | * JdbcAccess is responsible for establishing performing | |
26 | * SQL Queries against remote Databases. | |
27 | * It hides all knowledge about JDBC from the | |
28 | * {@link org.apache.ojb.broker.PersistenceBroker} | |
29 | * | |
30 | * @author <a href="mailto:thma@apache.org">Thomas Mahler</a> | |
31 | * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a> | |
32 | * @version $Id: JdbcAccess.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $ | |
33 | */ | |
34 | public interface JdbcAccess | |
35 | { | |
36 | /** | |
37 | * performs a DELETE operation against RDBMS. | |
38 | * @param cld ClassDescriptor providing mapping information. | |
39 | * @param obj The object to be deleted. | |
40 | */ | |
41 | public void executeDelete(ClassDescriptor cld, Object obj) throws PersistenceBrokerException; | |
42 | ||
43 | /** | |
44 | * performs a DELETE operation based on the given {@link Query} against RDBMS. | |
45 | * @param query the query string. | |
46 | * @param cld ClassDescriptor providing JDBC information. | |
47 | */ | |
48 | public void executeDelete(Query query, ClassDescriptor cld) throws PersistenceBrokerException; | |
49 | ||
50 | /** | |
51 | * performs an INSERT operation against RDBMS. | |
52 | * @param obj The Object to be inserted as a row of the underlying table. | |
53 | * @param cld ClassDescriptor providing mapping information. | |
54 | */ | |
55 | public void executeInsert(ClassDescriptor cld, Object obj) throws PersistenceBrokerException; | |
56 | ||
57 | /** | |
58 | * performs a SQL SELECT statement against RDBMS. | |
59 | * @param sqlStatement the query string. | |
60 | * @param cld ClassDescriptor providing meta-information. | |
61 | * @param scrollable Does this resultset need cursor control for operations like last, first and size | |
62 | */ | |
63 | public ResultSetAndStatement executeSQL(String sqlStatement, ClassDescriptor cld, boolean scrollable) throws PersistenceBrokerException; | |
64 | ||
65 | /** | |
66 | * performs a SQL SELECT statement against RDBMS. | |
67 | * @param sqlStatement the query string. | |
68 | * @param cld ClassDescriptor providing meta-information. | |
69 | * @param values The set of values to bind to the statement (may be null) | |
70 | * @param scrollable Does this resultset need cursor control for operations like last, first and size | |
71 | */ | |
72 | public ResultSetAndStatement executeSQL(String sqlStatement, ClassDescriptor cld, ValueContainer[] values, boolean scrollable) throws PersistenceBrokerException; | |
73 | ||
74 | /** | |
75 | * performs a SQL UPDTE, INSERT or DELETE statement against RDBMS. | |
76 | * @param sqlStatement the query string. | |
77 | * @param cld ClassDescriptor providing meta-information. | |
78 | * @return int returncode | |
79 | */ | |
80 | public int executeUpdateSQL(String sqlStatement, ClassDescriptor cld) | |
81 | throws PersistenceBrokerException; | |
82 | ||
83 | /** | |
84 | * performs a SQL UPDTE, INSERT or DELETE statement against RDBMS. | |
85 | * @param sqlStatement the query string. | |
86 | * @param cld ClassDescriptor providing meta-information. | |
87 | * @param values1 The first set of values to bind to the statement (may be null) | |
88 | * @param values2 The second set of values to bind to the statement (may be null) | |
89 | * @return int returncode | |
90 | */ | |
91 | public int executeUpdateSQL(String sqlStatement, ClassDescriptor cld, ValueContainer[] values1, ValueContainer[] values2) | |
92 | throws PersistenceBrokerException; | |
93 | /** | |
94 | * performs an UPDATE operation against RDBMS. | |
95 | * @param obj The Object to be updated in the underlying table. | |
96 | * @param cld ClassDescriptor providing mapping information. | |
97 | */ | |
98 | public void executeUpdate(ClassDescriptor cld, Object obj) throws PersistenceBrokerException; | |
99 | ||
100 | /** | |
101 | * performs a primary key lookup operation against RDBMS and materializes | |
102 | * an object from the resulting row. Only skalar attributes are filled from | |
103 | * the row, references are not resolved. | |
104 | * @param oid contains the primary key info. | |
105 | * @param cld ClassDescriptor providing mapping information. | |
106 | * @return the materialized object, null if no matching row was found or if | |
107 | * any error occured. | |
108 | */ | |
109 | public Object materializeObject(ClassDescriptor cld, Identity oid) | |
110 | throws PersistenceBrokerException; | |
111 | ||
112 | /** | |
113 | * performs a SELECT operation against RDBMS. | |
114 | * @param query the query string. | |
115 | * @param cld ClassDescriptor providing JDBC information. | |
116 | */ | |
117 | public ResultSetAndStatement executeQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException; | |
118 | } |