You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Tegan Clark <te...@yahoo.com> on 2006/12/15 00:40:26 UTC

ParameterSetter.getPreparedStatement()

Hi,

I'm implementing a custom type handler to map to custom types in Oracle stored procedure calls.

I've implemented TypeHandlerCallback and the setParameter method.

My problem is that when I try to get a handle to the underlying prepared statement:

    public void setParameter(ParameterSetter setter, Object parameter) throws SQLException {
        OraclePreparedStatement preparedStatement = (OraclePreparedStatement) setter.getPreparedStatement();

i get a class cast exception because ParameterSetter.getPreparedStatement() is returning a proxy ($proxy5), rather than the concrete Oracle implementation.

I've used an approach almost identical to the one on the iBatis wiki at:

    http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java

That code would have exactly the same problem as I'm having.  I'm using iBatis 2.2.0.638.

Anyone come across this before?

All help greatly appreciated.

Tegan




 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.

Re: ParameterSetter.getPreparedStatement()

Posted by Jeff Butler <je...@gmail.com>.
Oracle non-standard JDBC calls are a real pain!  You'll have to do different
things depending on the logging level in iBATIS and the datasource that you
use.  See this for more detailed information:

http://www.mail-archive.com/user-java@ibatis.apache.org/msg06898.html

Jeff Butler



On 12/14/06, Tegan Clark <te...@yahoo.com> wrote:
>
>  Hi,
>
> I'm implementing a custom type handler to map to custom types in Oracle
> stored procedure calls.
>
> I've implemented TypeHandlerCallback and the setParameter method.
>
> My problem is that when I try to get a handle to the underlying prepared
> statement:
>
>     public void setParameter(ParameterSetter setter, Object parameter)
> throws SQLException {
>         OraclePreparedStatement preparedStatement =
> (OraclePreparedStatement) setter.getPreparedStatement();
>
> i get a class cast exception because ParameterSetter.getPreparedStatement()
> is returning a proxy ($proxy5), rather than the concrete Oracle
> implementation.
>
> I've used an approach almost identical to the one on the iBatis wiki at:
>
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java
>
> That code would have exactly the same problem as I'm having.  I'm using
> iBatis 2.2.0.638.
>
> Anyone come across this before?
>
> All help greatly appreciated.
>
> Tegan
>
> ------------------------------
> Have a burning question? Go to Yahoo! Answers<http://answers.yahoo.com/;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx>and get answers from real people who know.
>