001: package org.apache.ojb.broker.accesslayer;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: import org.apache.ojb.broker.Identity;
019: import org.apache.ojb.broker.PersistenceBrokerException;
020: import org.apache.ojb.broker.core.ValueContainer;
021: import org.apache.ojb.broker.metadata.ClassDescriptor;
022: import org.apache.ojb.broker.query.Query;
023:
024: /**
025: * JdbcAccess is responsible for establishing performing
026: * SQL Queries against remote Databases.
027: * It hides all knowledge about JDBC from the
028: * {@link org.apache.ojb.broker.PersistenceBroker}
029: *
030: * @author <a href="mailto:thma@apache.org">Thomas Mahler</a>
031: * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
032: * @version $Id: JdbcAccess.java,v 1.34.2.1 2005/12/21 22:22:58 tomdz Exp $
033: */
034: public interface JdbcAccess {
035: /**
036: * performs a DELETE operation against RDBMS.
037: * @param cld ClassDescriptor providing mapping information.
038: * @param obj The object to be deleted.
039: */
040: public void executeDelete(ClassDescriptor cld, Object obj)
041: throws PersistenceBrokerException;
042:
043: /**
044: * performs a DELETE operation based on the given {@link Query} against RDBMS.
045: * @param query the query string.
046: * @param cld ClassDescriptor providing JDBC information.
047: */
048: public void executeDelete(Query query, ClassDescriptor cld)
049: throws PersistenceBrokerException;
050:
051: /**
052: * performs an INSERT operation against RDBMS.
053: * @param obj The Object to be inserted as a row of the underlying table.
054: * @param cld ClassDescriptor providing mapping information.
055: */
056: public void executeInsert(ClassDescriptor cld, Object obj)
057: throws PersistenceBrokerException;
058:
059: /**
060: * performs a SQL SELECT statement against RDBMS.
061: * @param sqlStatement the query string.
062: * @param cld ClassDescriptor providing meta-information.
063: * @param scrollable Does this resultset need cursor control for operations like last, first and size
064: */
065: public ResultSetAndStatement executeSQL(String sqlStatement,
066: ClassDescriptor cld, boolean scrollable)
067: throws PersistenceBrokerException;
068:
069: /**
070: * performs a SQL SELECT statement against RDBMS.
071: * @param sqlStatement the query string.
072: * @param cld ClassDescriptor providing meta-information.
073: * @param values The set of values to bind to the statement (may be null)
074: * @param scrollable Does this resultset need cursor control for operations like last, first and size
075: */
076: public ResultSetAndStatement executeSQL(String sqlStatement,
077: ClassDescriptor cld, ValueContainer[] values,
078: boolean scrollable) throws PersistenceBrokerException;
079:
080: /**
081: * performs a SQL UPDTE, INSERT or DELETE statement against RDBMS.
082: * @param sqlStatement the query string.
083: * @param cld ClassDescriptor providing meta-information.
084: * @return int returncode
085: */
086: public int executeUpdateSQL(String sqlStatement, ClassDescriptor cld)
087: throws PersistenceBrokerException;
088:
089: /**
090: * performs a SQL UPDTE, INSERT or DELETE statement against RDBMS.
091: * @param sqlStatement the query string.
092: * @param cld ClassDescriptor providing meta-information.
093: * @param values1 The first set of values to bind to the statement (may be null)
094: * @param values2 The second set of values to bind to the statement (may be null)
095: * @return int returncode
096: */
097: public int executeUpdateSQL(String sqlStatement,
098: ClassDescriptor cld, ValueContainer[] values1,
099: ValueContainer[] values2) throws PersistenceBrokerException;
100:
101: /**
102: * performs an UPDATE operation against RDBMS.
103: * @param obj The Object to be updated in the underlying table.
104: * @param cld ClassDescriptor providing mapping information.
105: */
106: public void executeUpdate(ClassDescriptor cld, Object obj)
107: throws PersistenceBrokerException;
108:
109: /**
110: * performs a primary key lookup operation against RDBMS and materializes
111: * an object from the resulting row. Only skalar attributes are filled from
112: * the row, references are not resolved.
113: * @param oid contains the primary key info.
114: * @param cld ClassDescriptor providing mapping information.
115: * @return the materialized object, null if no matching row was found or if
116: * any error occured.
117: */
118: public Object materializeObject(ClassDescriptor cld, Identity oid)
119: throws PersistenceBrokerException;
120:
121: /**
122: * performs a SELECT operation against RDBMS.
123: * @param query the query string.
124: * @param cld ClassDescriptor providing JDBC information.
125: */
126: public ResultSetAndStatement executeQuery(Query query,
127: ClassDescriptor cld) throws PersistenceBrokerException;
128: }
|