1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Integer mydata =
(Integer) execute(
new CallableStatementCreator() {
public CallableStatement createCallableStatement(
Connection connection) throws SQLException {
CallableStatement statement =
connection.prepareCall(CREATE_TOPIC_SQL);
int index = 0;
statement.setInt(++index, topic.getCompoundId());
statement.setInt(++index, -1);
statement.setInt(++index, topic.getTopicId());
statement.registerOutParameter(++index, Types.NUMERIC);
return statement;
}
},
new CallableStatementCallback() {
public Object doInCallableStatement(
CallableStatement cs) throws SQLException {
cs.execute();
return new Long(cs.getInt(TOPIC_ID_OUT));
}
}); |