I have this function that executes a stored procedure on our mssql server
public void addProjectMember(String projectRefNo, Long projectMemberId, Long userId)
{
logger.info("addProjectMember | BEGIN " + projectRefNo);
logger.debug("addProjectMember | projectMemberId - user | " + projectMemberId + " - " + userId);
Integer result = 0;
CallableStatement cal = null;
try{
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SessionImpl sessionImpl = (SessionImpl) session;
cal = sessionImpl.connection().prepareCall("{call PS_ADD_PRJMEM(?,?,?)}");
cal.setString(1, projectRefNo);
cal.setLong(2, projectMemberId);
cal.setLong(3, userId);
result = cal.executeUpdate();
} catch(SQLException e){
logger.error("Error in calling stored procedure PS_ADD_PRJMEM", e);
} finally {
try {
if (cal != null) {
cal.close();
}
} catch (SQLException e) {
logger.error("Error in clossing CallableStatement", e);
}
}
logger.info("addProjectMember | END " + result.intValue());
}
The results returns 1, there is no error upon execution and I make sure the stored procedure's parameters are in correct order and data type. When I run the stored procedure manually, it does its job and works normally.
This way of calling stored procedure is commonly used on our project so I am really struggling why this is not working on this time.
Also is there a specific characteristic of a stored procedure that will probably cause this issue, I noticed on the stored procedure that it is calling another stored procedure but I doubt that is causing this issue.