Hi , I solved the issue XMLType.CreateXML method returns null when i pass ops.getConnection and (Document)parameter.
Instead of passwing Document arugment i converted document to StringWriter using Transformer and the passed String object in the XMLType.createXML . Now the storedProcedure successfully insert/update XMLType column. Thanks for your useful suggestions and solutions. Thanks Bala. On Thu, Aug 21, 2008 at 9:44 AM, bala r <[EMAIL PROTECTED]> wrote: > Hi, > > I am using Apache-Common DBCP datasource with Spring&Ibatis. > So i have followed Juans example(Comment section) for getting > oraclePreparedStatement in the following URL. > > > http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java > > I modified the setParameter as exactly he described. > > I see both ops and parameter is not null in the setParameter method. > But XMLType.createXML is always return null and call to stored procedure > throws oracle error "wrong number of arguments or types". > > If i force to all setNull method the following line of code to validate my > storedprocedure, then insert/update statements in the procedure works fine.. > > ops.setNull(setter.getParameterIndex(), > // oracle.jdbc.OracleTypes.OPAQUE, "SYS.XMLTYPE"); > > So the issue is with the XMLType.createXML. i have also changed the > datasource to Spring Basic Datasource and modifed the setParameter, but > result is same.. > > I have correct version xdb.jar in the classpath. > > Any one else has similar issue? > > Thanks > Bala. > > > > > On Wed, Aug 20, 2008 at 2:46 PM, Jeff Butler <[EMAIL PROTECTED]>wrote: > >> You will need to make a similar modification to the setParameter method in >> the type handler. >> >> Jeff Butler >> >> On Wed, Aug 20, 2008 at 1:42 PM, bala r <[EMAIL PROTECTED]> wrote: >> >>> Jeff, >>> I think the solution is for SELECT not for Insert/Update.. >>> I am having issue when i execute insert/update statement inside the >>> Procedure.. >>> >>> Thanks >>> Bala. >>> >>> >>> >>> On Wed, Aug 20, 2008 at 12:12 PM, Jeff Butler <[EMAIL PROTECTED]>wrote: >>> >>>> Wow - impatient! >>>> >>>> A simple google query lead me to this: >>>> >>>> https://issues.apache.org/jira/browse/IBATIS-397 >>>> >>>> There is a known issue with iBATIS when using procedures and type >>>> handlers together with Oracle. There is a suggested workaround in this bug >>>> report that requires a simple modification to iBATIS code, and to the type >>>> handler. >>>> >>>> Jeff Butler >>>> >>>> On Wed, Aug 20, 2008 at 10:28 AM, bala r <[EMAIL PROTECTED]> wrote: >>>> >>>>> Hi All, >>>>> Any solution or suggestions for this XMLType issue? I will have to >>>>> solve this issue by end of today. >>>>> Any helps would be very highly appreciated. >>>>> >>>>> Thanks >>>>> Bala. >>>>> >>>>> >>>>> ---------- Forwarded message ---------- >>>>> From: bala r <[EMAIL PROTECTED]> >>>>> Date: Wed, Aug 20, 2008 at 10:06 AM >>>>> Subject: Help needed for Handling Oracle XMLType in Ibatis >>>>> To: user-java@ibatis.apache.org >>>>> >>>>> >>>>> Hi, >>>>> >>>>> I have to insert/update XMLtype datatype using Ibatis, My insert/update >>>>> statement are in storedprocedure >>>>> >>>>> 1. I added the following entry in the sqlMapConfig file >>>>> <typeHandler javaType="org.w3c.dom.Document" >>>>> callBack="XMLTypeHandlerCallBack"/> >>>>> >>>>> 2.My SQLmap Resource >>>>> >>>>> <parameterMap id="product_map" class="java.util.HashMap" > >>>>> <parameter property="item_type_id" >>>>> jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/> >>>>> <parameter property="item_id" >>>>> jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/> >>>>> <parameter property="web_display_name" >>>>> jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/> >>>>> <parameter property="url" >>>>> jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/> >>>>> <parameter property="uri" >>>>> jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/> >>>>> <parameter property="xml_content" jdbcType="XMLTYPE" >>>>> javaType="org.w3c.dom.Document" mode="IN/> >>>>> </parameter> >>>>> <procedure id="product" parameterMap="product_map"> >>>>> {call product.load (?,?,?,?,?,?)} >>>>> </procedure> >>>>> >>>>> 3. Stored Procedure paramers are as >>>>> Procedure load( >>>>> item_type_id IN VARCHAR2, >>>>> item_id IN VARCHAR2, >>>>> web_display_name IN VARCHAR2, >>>>> url IN VARCHAR2, >>>>> uri IN VARCHAR2, >>>>> xml_content IN XMLTYPE); >>>>> >>>>> Getting the following exception.. >>>>> org.springframework.jdbc. UncategorizedSQLException: SqlMapClient >>>>> operation; uncategorized SQLException for SQL []; SQL state [null]; error >>>>> code [0]; >>>>> --- The error occurred in product_mapper.xml. >>>>> --- The error occurred while applying a parameter map. >>>>> --- Check the product_mapper.product_overview_map. >>>>> --- Check the parameter mapping for the 'xml_content' property. >>>>> --- Cause: java.lang.UnsupportedOperationException: XMLType mapping >>>>> only supported for Oracle RDBMS; nested exception is >>>>> com.ibatis.common.jdbc.exception.NestedSQLException: >>>>> --- The error occurred in product_mapper.xml. >>>>> --- The error occurred while applying a parameter map. >>>>> --- Check the product_mapper.product_overview_map. >>>>> --- Check the parameter mapping for the 'xml_content' property. >>>>> --- Cause: java.lang.UnsupportedOperationException: XMLType mapping >>>>> only supported for Oracle RDBMS >>>>> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: >>>>> >>>>> If i move my insert statment to sqlMap file instead of storedprocedure >>>>> call then XMLType works.. >>>>> Struggling to solve this issue since from yesterday morning but keep >>>>> getting the same error. >>>>> >>>>> Thanks in Advance. >>>>> >>>>> Thanks >>>>> bala. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >> >