org.jpox.store.rdbms.request
Class Request

java.lang.Object
  extended byorg.jpox.store.rdbms.request.Request
Direct Known Subclasses:
DeleteRequest, FetchRequest, InsertRequest, LocateRequest, UpdateRequest

public abstract class Request
extends java.lang.Object

Base class representing a request to perform an action on the datastore. All requests have 2 methods - constructor and execute. Currently they build an SQL statement and execute it.

Version:
$Revision: 1.8 $

Field Summary
protected  PrimaryKey key
           
protected static Localiser LOCALISER
          Localisation of messages.
protected  DatastoreClass table
           
 
Constructor Summary
Request(DatastoreClass table)
          Constructor, taking the table to use for the request.
 
Method Summary
abstract  void execute(StateManager sm)
          Method to execute the request - to be implemented by deriving classes.
 java.sql.ResultSet executeQuery(java.lang.String jdbcText, java.sql.PreparedStatement ps)
          Convenience wrapper for executing a JDBC update.
 void executeUpdate(java.lang.String jdbcText, java.sql.PreparedStatement ps)
          Convenience wrapper for executing a JDBC update.
static java.lang.String replaceParamPlaceholdersWithValues(java.lang.String jdbcText, java.sql.PreparedStatement ps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation of messages.


table

protected final DatastoreClass table

key

protected final PrimaryKey key
Constructor Detail

Request

public Request(DatastoreClass table)
Constructor, taking the table to use for the request.

Parameters:
table - The Table to use for the request.
Method Detail

execute

public abstract void execute(StateManager sm)
Method to execute the request - to be implemented by deriving classes.

Parameters:
sm - The StateManager for the object in question.

executeUpdate

public void executeUpdate(java.lang.String jdbcText,
                          java.sql.PreparedStatement ps)
                   throws java.sql.SQLException
Convenience wrapper for executing a JDBC update. Provides logging of the statement and its execution time.

Parameters:
jdbcText - The statement text
ps - The PreparedStatement
Throws:
java.sql.SQLException - Thrown if an error occurs in the update

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String jdbcText,
                                       java.sql.PreparedStatement ps)
                                throws java.sql.SQLException
Convenience wrapper for executing a JDBC update. Provides logging of the statement and its execution time.

Parameters:
jdbcText - The statement text
ps - The PreparedStatement
Returns:
the ResultSet
Throws:
java.sql.SQLException - Thrown if an error occurs in the update

replaceParamPlaceholdersWithValues

public static java.lang.String replaceParamPlaceholdersWithValues(java.lang.String jdbcText,
                                                                  java.sql.PreparedStatement ps)


Copyright © -2007 . All Rights Reserved.