org.jaffa.persistence.engines.jdbcengine.querygenerator
Class JdbcBridge

java.lang.Object
  extended byorg.jaffa.persistence.engines.jdbcengine.querygenerator.JdbcBridge

public class JdbcBridge
extends Object

Use the methods of this class to execute various operations on the database.


Method Summary
static void executeAdd(IPersistent object, DataSource dataSource)
          Adds the Persistent object to the database.
static void executeDelete(IPersistent object, DataSource dataSource)
          Deletes the Persistent object from the database.
static void executeLock(IPersistent object, DataSource dataSource)
          Locks the underlying database row of the Persistent object.
static Collection executeQuery(Criteria criteria, DataSource dataSource)
          Executes the query based on the Criteria object.
static void executeStoredProcedure(IStoredProcedure sp, DataSource dataSource)
          Executes the Stored Procedure.
static void executeUpdate(IPersistent object, DataSource dataSource)
          Updates the Persistent object in the database.
static void updatePersistentFlagsOnAdd(IPersistent object)
          This method sets the appropriate flags on a Persistent object after being added to the database.
static void updatePersistentFlagsOnDelete(IPersistent object)
          This method sets the appropriate flags on a Persistent object after being deleted from the database.
static void updatePersistentFlagsOnLock(IPersistent object)
          This method sets the appropriate flags on a Persistent object after the underlying row is locked in the database.
static void updatePersistentFlagsOnQuery(IPersistent object, Criteria criteria)
          This method sets the appropriate flags on a Persistent object after being retrieved from the database.
static void updatePersistentFlagsOnUpdate(IPersistent object)
          This method sets the appropriate flags on a Persistent object after being updated to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeAdd

public static void executeAdd(IPersistent object,
                              DataSource dataSource)
                       throws SQLException,
                              IllegalAccessException,
                              InvocationTargetException,
                              IOException
Adds the Persistent object to the database.

Parameters:
object - The object to be added.
dataSource - The DataSource to which the object will be added.
Throws:
SQLException - if any database error occurs.
IllegalAccessException - if the Persistent class is not accessible for introspection.
InvocationTargetException - if the accessor method for the Persistent class throws an exception.
IOException - if any error occurs while extracting the value for an attribute.

executeUpdate

public static void executeUpdate(IPersistent object,
                                 DataSource dataSource)
                          throws SQLException,
                                 IllegalAccessException,
                                 InvocationTargetException,
                                 IOException
Updates the Persistent object in the database.

Parameters:
object - The object to be updated.
dataSource - The DataSource in which the object will be updated.
Throws:
SQLException - if any database error occurs.
IllegalAccessException - if the Persistent class is not accessible for introspection.
InvocationTargetException - if the accessor method for the Persistent class throws an exception.
IOException - if any error occurs while extracting the value for an attribute.

executeDelete

public static void executeDelete(IPersistent object,
                                 DataSource dataSource)
                          throws SQLException,
                                 IllegalAccessException,
                                 InvocationTargetException,
                                 IOException
Deletes the Persistent object from the database.

Parameters:
object - The object to be deleted.
dataSource - The DataSource from which the object will be deleted.
Throws:
SQLException - if any database error occurs.
IllegalAccessException - if the Persistent class is not accessible for introspection.
InvocationTargetException - if the accessor method for the Persistent class throws an exception.
IOException - if any error occurs while extracting the value for an attribute.

executeQuery

public static Collection executeQuery(Criteria criteria,
                                      DataSource dataSource)
                               throws IOException,
                                      SQLException,
                                      PostLoadFailedException,
                                      DataSourceCursorRuntimeException
Executes the query based on the Criteria object.

Parameters:
criteria - The input Criteria.
dataSource - The DataSource against which the query is to be executed.
Returns:
a Collection of Persistent objects as a result of the query.
Throws:
IOException - if any error occurs while extracting the String from the criteria.
SQLException - if any database error occurs.
PostLoadFailedException - if any error is thrown in the PostLoad trigger of the persistent object.
DataSourceCursorRuntimeException - if any error occurs while molding the row into the Persistent object.

executeStoredProcedure

public static void executeStoredProcedure(IStoredProcedure sp,
                                          DataSource dataSource)
                                   throws SQLException,
                                          IllegalAccessException,
                                          InvocationTargetException,
                                          IOException
Executes the Stored Procedure.

Parameters:
sp - The Stored Procedure to execute.
dataSource - The DataSource against which the Stored Procedure is to be executed.
Throws:
SQLException - if any database error occurs.
IllegalAccessException - if the class is not accessible.
InvocationTargetException - if the accessor/mutator method for the Stored Procedure throws an exception.
IOException - if any error occurs in reading the data from the database.

executeLock

public static void executeLock(IPersistent object,
                               DataSource dataSource)
                        throws SQLException,
                               IllegalAccessException,
                               InvocationTargetException,
                               IOException
Locks the underlying database row of the Persistent object.

Parameters:
object - The object to be locked.
dataSource - The DataSource in which the object will be locked.
Throws:
SQLException - if any database error occurs.
IllegalAccessException - if the Persistent class is not accessible for introspection.
InvocationTargetException - if the accessor method for the Persistent class throws an exception.
IOException - if any error occurs while extracting the value for an attribute.

updatePersistentFlagsOnAdd

public static void updatePersistentFlagsOnAdd(IPersistent object)
This method sets the appropriate flags on a Persistent object after being added to the database.

Parameters:
object - the Persistent object.

updatePersistentFlagsOnUpdate

public static void updatePersistentFlagsOnUpdate(IPersistent object)
This method sets the appropriate flags on a Persistent object after being updated to the database.

Parameters:
object - the Persistent object.

updatePersistentFlagsOnDelete

public static void updatePersistentFlagsOnDelete(IPersistent object)
This method sets the appropriate flags on a Persistent object after being deleted from the database.

Parameters:
object - the Persistent object.

updatePersistentFlagsOnQuery

public static void updatePersistentFlagsOnQuery(IPersistent object,
                                                Criteria criteria)
This method sets the appropriate flags on a Persistent object after being retrieved from the database.

Parameters:
object - the Persistent object.
criteria - the Criteria used for retrieving the object.

updatePersistentFlagsOnLock

public static void updatePersistentFlagsOnLock(IPersistent object)
This method sets the appropriate flags on a Persistent object after the underlying row is locked in the database.

Parameters:
object - the Persistent object.


Copyright © 2002-2004 JAFFA Project.