Skip to main content

Posts

Showing posts with the label out-parameters

Java MyBatis stored procedure call with OUT parameters

First question: I am trying to return one OUT parameter and not a result set with annotations. First, is it even possible? If it is, how would one do this? MyBatis: 3.0.6 Database: SQL Server 2008 Here is an example of the syntax of my method call in the UserDAO: @Select(value= "{ CALL saveUser( " + "#{userId, mode=IN, jdbcType=INTEGER}," + "#{firstname, mode=IN, jdbcType=VARCHAR}," + "#{lastname, mode=IN, jdbcType=VARCHAR}," + "#{message, mode=OUT, jdbcType=VARCHAR}" + ")}") @Options(statementType=StatementType.CALLABLE) public String saveUser( @Param("userId") int userId, @Param("firstname") String firstname, @Param("lastname") String lastname); I am returning a message from all of my "save" procedures and so I can return a response to the user: "User save successfully","Error saving user",&q