de.mathema.pride
Class PreparedStatementAccess

java.lang.Object
  extended by de.mathema.pride.PreparedStatementAccess

public class PreparedStatementAccess
extends java.lang.Object

This class holds meta information about access methods to JDBC prepared statements. It is required for PriDE's generic way of writing record fields to the database.

Author:
Jan Lessner

Field Summary
static java.lang.String REVISION_ID
           
 
Constructor Summary
PreparedStatementAccess()
           
 
Method Summary
static void init()
          Initialize the class by the default type mappings below.
static void putMethod(java.lang.String methodName, java.lang.Class paramType)
           
static void putMethod(java.lang.String methodName, java.lang.Class functionParamType, java.lang.Class valueType)
          Adds a prepared statement access method for a specified type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION_ID

public static final java.lang.String REVISION_ID
See Also:
Constant Field Values
Constructor Detail

PreparedStatementAccess

public PreparedStatementAccess()
Method Detail

putMethod

public static void putMethod(java.lang.String methodName,
                             java.lang.Class paramType)
                      throws java.lang.NoSuchMethodException
Throws:
java.lang.NoSuchMethodException

putMethod

public static void putMethod(java.lang.String methodName,
                             java.lang.Class functionParamType,
                             java.lang.Class valueType)
                      throws java.lang.NoSuchMethodException
Adds a prepared statement access method for a specified type

Parameters:
methodName - Name of the access method to register. The method is assumed to be applicable to the PreparedStatement class for access by integer index.
functionParamType - Type of parameter to be passed to the prepared statement access method denoted by parameter methodName.
valueType - Type of value returned by a getter method of a source object. This parameter is required to express mappings like Float -> float. If it is null, the functionParamType is used.
Throws:
java.lang.NoSuchMethodException - if the specified method is not available for class java.sql.ResultSet

init

public static void init()
                 throws java.lang.NoSuchMethodException
Initialize the class by the default type mappings below. As a difference to the corresponding function in ResultSetAccess there is no mapping for java.util.Date as this type is not supported as input for prepared statements parameters. As a work around you may provide additional getter methods in you entity, providing a conversion to either java.sql.Date or java.sql.Timestamp.

Throws:
java.lang.NoSuchMethodException