- 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
get
(BindingGetSQLInputContext<U> ctx) Get aSQLInput
'sOUT
value.void
get
(BindingGetStatementContext<U> ctx) Get aCallableStatement
'sOUT
value.void
register
(BindingRegisterContext<U> ctx) Register aCallableStatement
'sOUT
parameter.void
set
(BindingSetSQLOutputContext<U> ctx) Set aSQLOutput
'sIN
parameter.void
sql
(BindingSQLContext<U> ctx) A convenient base implementation that handles theParamType
setting and delegates tosqlInline(BindingSQLContext)
orsqlBind(BindingSQLContext)
respectively.protected void
sqlBind
(BindingSQLContext<U> ctx) Generate the SQL string for a bind variable placeholder.protected void
sqlInline
(BindingSQLContext<U> ctx) Generate the SQL string for inline values.
-
Constructor Details
-
AbstractBinding
public AbstractBinding()
-
-
Method Details
-
sql
A convenient base implementation that handles theParamType
setting and delegates tosqlInline(BindingSQLContext)
orsqlBind(BindingSQLContext)
respectively.- Specified by:
sql
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
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:Binding
Register aCallableStatement
'sOUT
parameter.- Specified by:
register
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
Description copied from interface:Binding
Get aCallableStatement
'sOUT
value.Implementations are expected to produce a value by calling
BindingGetStatementContext.value(Object)
, passing the resulting value to the method.- Specified by:
get
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
set
Description copied from interface:Binding
Set aSQLOutput
'sIN
parameter.- Specified by:
set
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-
get
Description copied from interface:Binding
Get aSQLInput
'sOUT
value.Implementations are expected to produce a value by calling
BindingGetSQLInputContext.value(Object)
, passing the resulting value to the method.- Specified by:
get
in interfaceBinding<T,
U> - Parameters:
ctx
- The context object containing all argument objects.- Throws:
SQLException
- Implementations are allowed to pass on allSQLException
s to the caller to be wrapped inDataAccessException
s.
-