- All Implemented Interfaces:
Serializable,Binding<T,U>
The simplification is provided by offering empty implementations for rarely used methods, such as those for stored procedure OUT parameter support:
register(BindingRegisterContext)to register the OUT parameter.get(BindingGetStatementContext)to read the OUT parameter.
or SQLData serialisation support (e.g. for Oracle user defined types):
set(BindingSetSQLOutputContext)to serialise a user defined type.get(BindingGetSQLInputContext)to read a user defined type.
- Author:
- Lukas Eder
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidget(BindingGetSQLInputContext<U> ctx) Get aSQLInput'sOUTvalue.voidget(BindingGetStatementContext<U> ctx) Get aCallableStatement'sOUTvalue.voidregister(BindingRegisterContext<U> ctx) Register aCallableStatement'sOUTparameter.voidset(BindingSetSQLOutputContext<U> ctx) Set aSQLOutput'sINparameter.voidsql(BindingSQLContext<U> ctx) A convenient base implementation that handles theParamTypesetting and delegates tosqlInline(BindingSQLContext)orsqlBind(BindingSQLContext)respectively.protected voidsqlBind(BindingSQLContext<U> ctx) Generate the SQL string for a bind variable placeholder.protected voidsqlInline(BindingSQLContext<U> ctx) Generate the SQL string for inline values.
-
Constructor Details
-
AbstractBinding
public AbstractBinding()
-
-
Method Details
-
sql
A convenient base implementation that handles theParamTypesetting and delegates tosqlInline(BindingSQLContext)orsqlBind(BindingSQLContext)respectively.- Specified by:
sqlin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
sqlInline
Generate the SQL string for inline values.The default implementation generates a string literal representation of the user defined value. Custom implementations may want to override this.
- Throws:
SQLException
-
sqlBind
Generate the SQL string for a bind variable placeholder.In almost all cases, this can just be a "?" string. In some cases, the placeholder needs to be cast to a vendor specific data type, such as in PostgreSQL, "?::tsvector".
- Throws:
SQLException
-
register
Description copied from interface:BindingRegister aCallableStatement'sOUTparameter.- Specified by:
registerin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
get
Description copied from interface:BindingGet aCallableStatement'sOUTvalue.Implementations are expected to produce a value by calling
BindingGetStatementContext.value(Object), passing the resulting value to the method.- Specified by:
getin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
set
Description copied from interface:BindingSet aSQLOutput'sINparameter.- Specified by:
setin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
get
Description copied from interface:BindingGet aSQLInput'sOUTvalue.Implementations are expected to produce a value by calling
BindingGetSQLInputContext.value(Object), passing the resulting value to the method.- Specified by:
getin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-