| java.lang.Object com.jat.integration.GenericDataSource com.jat.integration.db.GenericDatabaseDataSource
All known Subclasses: com.jat.integration.db.connectionpool.ConnectionPoolDataSource, com.jat.integration.db.JndiDataSource, com.jat.integration.db.JdbcDataSource,
GenericDatabaseDataSource | abstract public class GenericDatabaseDataSource extends GenericDataSource (Code) | | Title: JAT
Description: This class implements a generic access to database data source.
It contain methods to execute sql statements such as select, update, insert and stored procedure.
Query configuration:
For each query you have to define:
- name the name of the query
- value the value of the query (e.g. sql)
- type (optional) the type of the query (see
com.jat.integration.db.QueryDefinition costant field values).
By default the type of the query is automatically calculated
- response_plugin (optional) is the class name of an istance of
com.jat.integration.db.plugin.CheckReturnPlugin class
that checks the response of an insert/modify query or of a stored procedure: if an exception is catched, a rollback will be performed
- the list of fields (optional) of a query with parameters.
Note that the number of fields must be exactly as the number of parameters (symbol '?') of the value of query
For each field you have to define:
Example:
# a simple query
query1.name = myQueryName
query1.value = select * from dual
# a simple query with parameters
query2.name = myQueryName2
query2.value = select * from myTable where firstField = ? and secondField = ?
query2.field1.name = myFirstParameter
query2.field2.name = mySecondParameter
# calling a stored procedure with an input parameter and an output parameter
query3.name = callMyStoredProcedure
query3.value = { call MY_STORED_PROCEDURE(?,?)}
query3.field1.name = myInputParameter
query3.field2.name = myOutputParameter
query3.field2.output = true
Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)
Distributed under the terms of the GNU Lesser General Public License, v2.1 or later
author: stf version: 1.2 since: 1.2 See Also: com.jat.integration.DataSource See Also: com.jat.integration.db.QueryDefinition |
Method Summary | |
protected BusinessObjectProperties | callProcedure(Connection con, QueryDefinition qf, BusinessObjectProperties parameters) | final protected void | close(Connection con) | final protected void | commit(Connection con) | public BusinessObjectProperties | execute(String queryName, BusinessObjectProperties parameters) | public BusinessObjectPropertyList | execute(MultiBusinessObjectProperties multi) | protected BusinessObjectProperties | execute(Connection con, String queryName, BusinessObjectProperties parameters) | protected BusinessObjectProperties | executeQuery(Connection con, QueryDefinition qf, BusinessObjectProperties parameters) | protected CallableStatement | getCallableStatement(QueryDefinition qf, BusinessObjectProperties parameters, Connection con) | abstract protected Connection | getConnection() | public BusinessObjectPropertyList | getData(String queryName, BusinessObjectProperties parameters) | public GenericOperationDefinition | getEmptyOperationDefinition() | protected PreparedStatement | getPreparedStatement(QueryDefinition qf, BusinessObjectProperties parameters, Connection con) | protected BusinessObjectPropertyList | getRows(ResultSet rs) | final protected void | rollback(Connection con) | protected BusinessObjectPropertyList | select(QueryDefinition qf, BusinessObjectProperties parameters) |
|
|