[ https://issues.apache.org/jira/browse/IBATIS-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12465764 ]
Aravind commented on IBATIS-383: -------------------------------- Hi, I have Tried to Call the Same Stored Procedure thru CallableStatment and it was working Fine... Connection con = null; CallableStatement stmt = null; ResultSet result = null; try { InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("jdbc/nsadev"); con = ds.getConnection(); stmt = con.prepareCall("{CALL sp_savetransaction(?)}"); stmt.setString(1,"100"); /*stmt.setString(2, "testuser"); stmt.registerOutParameter(3, Types.VARCHAR); stmt.registerOutParameter(4, Types.VARCHAR);*/ result = stmt.executeQuery(); } catch (NamingException nex) { System.err.println("Naming Error: " + nex.getMessage()); } catch (SQLException sqlex) { sqlex.printStackTrace(); /*System.err.println("SQL Error: " + sqlex.getMessage()); System.out.println("Return Value:" + stmt.getString(1)); System.out.println("ErrorCode:" + stmt.getString(3)); System.out.println("Error Message:" + stmt.getString(4));*/ } if(result !=null) { //result.first(); result.next(); System.err.println(result.getString("TXN_ID")); } else { System.err.println("I am Inside NULL"); } I am getting the Back the Resultset from the Stored Procedure....But When i am using IBatis I am not getting back the Object. The Stored Procedure is Below create proc sp_savetransaction @P_TXN_ACCOUNT_I varchar(20) as DECLARE @v_txn_id int insert into TXN_MASTER ( AcctName ) values (@P_TXN_ACCOUNT_I) SET @v_txn_id = @@IDENTITY SELECT @v_txn_id AS TXN_ID return > IBATIS - SYBASE Stored Procedure NULL POINTER EXCEPTION > ------------------------------------------------------- > > Key: IBATIS-383 > URL: https://issues.apache.org/jira/browse/IBATIS-383 > Project: iBatis for Java > Issue Type: Bug > Environment: I am Using WAS5.1,Window Platform, IBATIS, SYBASE > Reporter: Aravind > Priority: Minor > > I have a Stored Procedure which insert Data into a Table and a Select > statement after that which returns the identity Column value back. > The following is the Parameter Map i am using Object > <!--Procedure to Save in Transaction Master STARTS --> > <resultMap id="saveTransactionResult" class="Transaction"> > <result property="transactionId" column="TXN_ID"/> > </resultMap> > <parameterMap id="saveTransactionParam" class="Transaction"> > <parameter property="assetInformation.price" jdbcType = "INTEGER" > javaType="java.lang.String" mode="IN"/> > <parameter property="profile.profileId" jdbcType = "VARCHAR" > javaType="java.lang.String" mode="IN"/> > <parameter property="transactionType" jdbcType = "VARCHAR" > javaType="java.lang.String" mode="IN"/> > <parameter property="assetInformation.draftFlag" jdbcType = "VARCHAR" > javaType="java.lang.String" mode="IN"/> > <parameter property="account.accountNumber" jdbcType = "VARCHAR" > javaType="java.lang.String" mode="IN"/> > <parameter property="assetInformation.assetId" jdbcType = "VARCHAR" > javaType="java.lang.String" mode="IN"/> > <parameter property="userId" jdbcType = "VARCHAR" javaType="java.lang.String" > mode="IN"/> > </parameterMap> > <procedure id="SAVE_TRANSACTION" parameterMap ="saveTransactionParam" > resultMap="saveTransactionResult"> > { call sp_savetransaction(?,?,?,?,?,?,?) } > </procedure> > Java Code where i make the Call to Stored Procedure is below.. > Transaction tran = (Transaction)queryForObject(SAVE_TRANSACTION, > transactionDto.getTransaction()); > I am using QueryforObject Method to Invoke the Stored Procedure. > Whenever the Stored Procedure has Select statements alone.. I am getting back > the Object with Data...But if the Stored Procedure is having Insert > Statements and then a select Statement ..The Object is not Returned and > giving NULL POINTER Exception while trying to Access the Object. But > Eventhough i get no object back the Insert Statement get executed > Successfully and i can see the Details in the Table. > Please help me on this Issue as we are not able to Proceed further...and we > are falling behind on our deadline dates for the project to go into Prodn due > to this issue... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira