You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "davide papotti (JIRA)" <ib...@incubator.apache.org> on 2005/06/06 17:21:42 UTC

[jira] Created: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

oracle's user-defined objects are not supported as store procedure out parameters   
------------------------------------------------------------------------------------

         Key: IBATIS-145
         URL: http://issues.apache.org/jira/browse/IBATIS-145
     Project: iBatis for Java
        Type: Improvement
  Components: SQL Maps  
    Versions: 2.1.0    
 Environment: oracle and maybe any others db that support user defined data types  
    Reporter: davide papotti


we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
This problem arises because to use these params the SQLExecutor class should call the ā€œcallableStatement.registerOutputParametersā€  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  

To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
  
Following the changes that I have made to add this enhancement:
Added property typeName to bean BasicParameterMapping, with set and get methods. 
Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "ING IKRS (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12331807 ] 

ING IKRS commented on IBATIS-145:
---------------------------------

I was able to use user-defined types with stored procedures after making a minor  modification (I made JdbcTypeRegistry.setType public) to the iBatis source downloaded beginning of September'05.
Below I include full description of my test code.

hi,

I was able to use iBatis to call stored procedures with array arguments, e.g. PS_VARCHAR_ARRAY_TYPE, after making only a minimal hack to the iBatis code.

My test stored procedure was:

/* prefixes prefix to all items in p_str_a and returns them in o_str_a */
PROCEDURE prefix( p_prefix IN VARCHAR2,
p_str_a IN PS_VARCHAR2_ARRAY_TYPE,
o_str_a OUT PS_VARCHAR2_ARRAY_TYPE);


The sql mapping in xml file was

<parameterMap id="prefixStringsParams" class="map" >
<parameter property="prefix" jdbcType="VARCHAR2" javaType="java.lang.String" mode="IN"/>
<parameter property="stringArray" jdbcType="PS_VARCHAR2_ARRAY_TYPE" typeName="PS_VARCHAR2_ARRAY_TYPE" typeHandler="StringArrayHandler" mode="IN"/>
<parameter property="prefixedStringArray" jdbcType="PS_VARCHAR2_ARRAY_TYPE" typeName="PS_VARCHAR2_ARRAY_TYPE" typeHandler="StringArrayHandler" mode="OUT"/>
</parameterMap>

<procedure id="prefixStrings" parameterMap="prefixStringsParams" >
{call TEST_IBATIS.prefix (?, ?, ?)}
</procedure>

In order to handle PS_VARCHAR2_ARRAY_TYPE I had to implement Custom TypeHandler

public class StringArrayTypeHandlerCallback implements TypeHandlerCallback {

static{
JdbcTypeRegistry.setType("PS_VARCHAR2_ARRAY_TYPE", Types.ARRAY); <<== here is where the hack was needed -- the setType method was private in JdbcTypeRegistry and I had to make it public in order to tell it that PS_VARCHAR2_ARRAY_TYPE corresponds to Types.ARRAY, otherwise I would get an exception
};

public void setParameter(ParameterSetter setter, Object parameter)
throws SQLException {
String[] strArr = (String[])parameter;
setter.getPreparedStatement().getConnection();
Connection conn = setter.getPreparedStatement().getConnection();
ArrayDescriptor stringArrayDescriptor = ArrayDescriptor.createDescriptor("PS_VARCHAR2_ARRAY_TYPE", conn);
ARRAY valArray;
try {
valArray = new ARRAY(stringArrayDescriptor, conn, strArr);
} catch (SQLException e) {
throw e;
}
setter.setArray(valArray);

}

public Object getResult(ResultGetter getter) throws SQLException {
Array arr = getter.getArray();
if(arr==null)
return null;
else
return (String[])arr.getArray();
}

public Object valueOf(String arg0) {
String[] r = new String[1];
r[0] = arg0;
return r;
}
}

The handler had to be registered in the main ibatis config file:

<typeAlias alias="StringArrayHandler" type="com.ingenuity.dbcommon.ibatis.StringArrayTypeHandlerCallback" />
<typeHandler javaType="[Ljava.lang.String;" callback="StringArrayHandler" />

The test code was this:

String resource = "com/ingenuity/dbcommon/ibatis/SqlMapConfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
Map dto = new HashMap();
dto.put("prefix", "pre-");
dto.put("stringArray", new String[]{"abc","cde"});
dto.put("prefixedStringArray", new String[]{});
printDto(dto);
sqlMap.update("prefixStrings", dto);
printDto(dto);

And the output was

prefix -> pre-
stringArray -> [abc, cde]
prefixedStringArray -> []
08:58:38.441 [main] DEBUG SimpleDataSource: Created connection 597230.
08:58:38.441 [main] DEBUG Connection: {conn-100000} Connection
08:58:38.631 [main] DEBUG PreparedStatement: {pstm-100001} PreparedStatement: {call TEST_IBATIS.prefix (?, ?, ?)}
08:58:38.641 [main] DEBUG PreparedStatement: {pstm-100001} Parameters: [pre-, oracle.sql.ARRAY@e0b6f5]
08:58:38.641 [main] DEBUG PreparedStatement: {pstm-100001} Types: [java.lang.String, oracle.sql.ARRAY]
08:58:38.661 [main] DEBUG SimpleDataSource: Returned connection 597230 to pool.
prefix -> pre-
stringArray -> [abc, cde]
prefixedStringArray -> [pre-abc, pre-cde]

As you can see the strings indeed got prefixed.

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j
>     Assignee: Brandon Goodin

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "ppz4j (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312775 ] 

ppz4j commented on IBATIS-145:
------------------------------

sure,  I have implemented a typehandler to convert the returned oracle varray  but the exception persists and is thrown when i try to set this type as output parameter.  
In the way  i have read the code the problem depends on the  call to the CallableStatement.registerOutParameter  method  wrong  version.  This thesis  is supported  by the jav a doc as i have already explained.

the right  code where the exception is not generated follows :
  private void registerOutputParameters(CallableStatement cs, ParameterMapping[] mappings) throws SQLException {
    for (int i = 0; i < mappings.length; i++) {
      BasicParameterMapping mapping = ((BasicParameterMapping) mappings[i]);
      if (mapping.isOutputAllowed()) { 
            if ( mapping.getTypeName() != null  ) { //@added 
                cs.registerOutParameter(i + 1, mapping.getJdbcType(), mapping.getTypeName() ); //@added
            } else { //@added
                cs.registerOutParameter(i + 1, mapping.getJdbcType());                
            } //@added
      }
    }  
best regards



> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312773 ] 

Brandon Goodin commented on IBATIS-145:
---------------------------------------

Have you tried using a custom type handler for this?

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312927 ] 

Brandon Goodin commented on IBATIS-145:
---------------------------------------

I can't promise you this functionality. I want to get larry and clinton to chime in on this. I don't see why we wouldn't provide this. I was actually looking at this recently and considering proposing it.

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312778 ] 

Brandon Goodin commented on IBATIS-145:
---------------------------------------

What oracle driver are you using?

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "ppz4j (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12313638 ] 

ppz4j commented on IBATIS-145:
------------------------------

very well, compliments for the timeliness. My tests gave successfull returns. Unfortunatally while i was testign i have found another bug that i have report in item IBATIS-153. 
best regards

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j
>     Assignee: Brandon Goodin

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312780 ] 

Brandon Goodin commented on IBATIS-145:
---------------------------------------

Also, why not simply use the ARRAY jdbc type and pass it into an Object[]? Does that not work as well?

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "ppz4j (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312922 ] 

ppz4j commented on IBATIS-145:
------------------------------

thanks so much for your interest and for explanations.  In next  three weeks  my project will be deployed in production enviroment, do you think that in the while this change will be integrated in the next release ? 
best regards 

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (IBATIS-145) oracle's user-defined objects are not supported as store procedure out parameters

Posted by "Brandon Goodin (JIRA)" <ib...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312790 ] 

Brandon Goodin commented on IBATIS-145:
---------------------------------------

I was just trying to determine if what we are facing is an oddity of the driver or if this is truly a change that we need to make to the ibatis code. You did not provide the full story at first. I have no knowledge of your expertise. So, basically, it sounded like you were saying that you needed to specify a user defined type for a varray which the oracle driver can successfully convert to an array. But, i can see that you truly have a bonified user defined sql type. When reporting issues it is helpful if you explain what solutions you have attempted and provide all the details up front. Thanks for your insight and code submission. 

I'd like to get some comments from the other developers before we commit this change.

Thoughts?

> oracle's user-defined objects are not supported as store procedure out parameters
> ---------------------------------------------------------------------------------
>
>          Key: IBATIS-145
>          URL: http://issues.apache.org/jira/browse/IBATIS-145
>      Project: iBatis for Java
>         Type: Improvement
>   Components: SQL Maps
>     Versions: 2.1.0
>  Environment: oracle and maybe any others db that support user defined data types  
>     Reporter: ppz4j

>
> we have to call legacy oracle store procedure with named array types as output parameters. When I try it I get an invalid parameter type exception
> This problem arises because to use these params the SQLExecutor class should call the ?callableStatement.registerOutputParameters?  method version with the typeName param. In fact the java doc of this method suggests "This version of the method registerOutParameter  should be used for a user-defined or REF output parameter" and "To be portable, however, applications should always provide these values for user-defined and REF parameters. Although it is intended for user-defined and REF parameters, this method may be used to register a parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the typeName parameter is ignored "  
> To handle this problem I have made some changes in source code and dtd file, but I hope that in a next version this problem will be resolved.   
>   
> Following the changes that I have made to add this enhancement:
> Added property typeName to bean BasicParameterMapping, with set and get methods. 
> Added code that load typeName param from xml in SqlMapParser and code that save it as property of the current instance of mapping.  
> Changed the SQLExecutor, now before call the CallableStatement.registerOutputParameter the registerOutputParameters method checks if the typeName of the given map parameter is not null. If it so it calls the  overloaded method registerOutParameter(int paramIndex,int sqlType,String typeName) instead of registerOutParameter(int paramIndex,int sqlType.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira