Hi folks,
I'm getting a SQLException when running a stored procedure. The error description looks like it's maybe coming from the database, but it's rather vague (Not in a transaction) and I thought I would check to make sure there was nothing I was missing on my end.
The code for the stored procedure private class:
I call with the following code:Code:private class UpdateOwnerTeamProcedure extends StoredProcedure { public UpdateOwnerTeamProcedure(JdbcTemplate template) { super(template, "updt_pref"); setFunction(false); declareParameter(new SqlParameter("ownerNumber", Types.INTEGER)); declareParameter(new SqlParameter("teamId", Types.INTEGER)); compile(); } public void execute(int ownerNumber, int teamId) { HashMap input = new HashMap(); input.put("ownerNumber", new Integer(ownerNumber)); input.put("teamId", new Integer(teamId)); execute(input); } }
Code:UpdateOwnerProcedure proc = new UpdateOwnerProcedure(getJdbcTemplate()); proc.execute(ownerNumber, teamId);
Running a unit test results in the following error:
Code:org.springframework.jdbc.UncategorizedSQLException: (executing CallableStatementCallback [CallableStatementCreatorFactory.CallableStatementCreatorImpl: sql=[{call updt_pref(?, ?)}]: params=[{ownerNumber=1, teamId=11}]]): encountered SQLException [Not in transaction.]; nested exception is java.sql.SQLException: Not in transaction.
Any suggestions appreciated. I tried using the CallableStatementCreator, but ran into different issues with that.


Reply With Quote