views:

56

answers:

0

Hi

I'm fairly new to ibatis and have to call a stored procedure which I need to pass in the following parameters

pi_decision_id int
pi_login_id uniqueidentifier
pi_search_id uniqueidentifier
pi_outcome_name uniqueidentifier
pi_decision_log uniqueidentifier
pi_test_dataset_id uniqueidentifier
pi_is_default bit
pi_primary_rule_id int
test_exec_id uniqueidentifier

The mapping I've created is as follows

    <parameterMap id="decisionLogInsertParameters" class="map">
    <parameter property="pi_decision_id" jdbcType="INTEGER" javaType="integer" mode="IN" />
    <parameter property="pi_login_id" jdbcType="VARCHAR" javaType="string" mode="IN" />    
    <parameter property="pi_search_id" jdbcType="VARCHAR" javaType="string" mode="IN" />
    <parameter property="pi_outcome_name" jdbcType="VARCHAR" javaType="string" mode="IN" />
    <parameter property="pi_decision_log_id" jdbcType="VARCHAR" javaType="string" mode="IN" />
    <parameter property="pi_test_dataset_id" jdbcType="VARCHAR" javaType="string" mode="IN" />
    <parameter property="pi_is_default" jdbcType="BIT" javaType="boolean" mode="IN" />
    <parameter property="pi_primary_rule_id" jdbcType="INTEGER" javaType="integer" mode="IN" />
    <parameter property="test_exec_id" jdbcType="VARCHAR" javaType="string" mode="IN" />
</parameterMap>

The problem is I get no data inserted into the db and no errors being thrown.

The logging is as follows

    2010-10-06 17:00:03 DEBUG [PreparedStatement.debug(27)] - {pstm-100001} Executing Statement: {call decision_log_insert(?, ?, ?, ?, ?, ?, ?, ?, ?)}
2010-10-06 17:00:03 DEBUG [PreparedStatement.debug(27)] - {pstm-100001} Parameters: [1, f49746c4-3985-436c-8a78-7d1862152fd6, b46abc9c-7b2c-4d6c-b7d6-c0c3d60427e7, ACCEPT, 5b796be3-c483-4992-855d-55307879bfb9, null, true, 12345, null]
2010-10-06 17:00:03 DEBUG [PreparedStatement.debug(27)] - {pstm-100001} Types: [java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, null, java.lang.Boolean, java.lang.Integer, null]

If I change the call and make all the UUID's have single quotes at the start and end like so "'" + UUID + "'" I then get an error message being thrown,

org.springframework.dao.DataIntegrityViolationException: SqlMapClient operation; SQL [];   
--- The error occurred in ibatis-mapping/logging.sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the DecisionMatrixActivityLogging.decisionLogInsertParameters.  
--- Check the statement (update procedure failed).  
--- Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Error converting data type nvarchar to uniqueidentifier.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in ibatis-mapping/logging.sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the DecisionMatrixActivityLogging.decisionLogInsertParameters.  
--- Check the statement (update procedure failed).  
--- Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Error converting data type nvarchar to uniqueidentifier.

Firstly I do not want to have to quote my strings when calling the SP in Ibatis because that should be handled by Ibatis I would have thought. Secondly why is it failing silently showing me the call to the SP but not producing anything substantial in the logging? Is the mapping for a UUID incorrect? I store the UUID's on the java side as Strings. Any help would be much appreciated.