You have to call either startTransaction or setUserConnection to call
getCurrentConnection, yes.

Cheers,
Clinton

On 6/11/07, Yu, Jack <[EMAIL PROTECTED]> wrote:

 Clinton,

    Thanks for response. We have tried getCurrentConnection, but we are
getting "null" back. Because we are not calling startTransaction or
setUserTransaction explicitly.

    Do you think we have to call startTransaction/setUserTransaction
explicitly to set TypeMap? Is there any other alternative? Currently we set
it in our customized
    HandleCallback class. Not sure whether that's the proper way.

    Thanks again.

    -- Jack



 ------------------------------
*From:* Clinton Begin [mailto:[EMAIL PROTECTED]
*Sent:* Friday, June 08, 2007 9:25 AM
*To:* [email protected]
*Subject:* Re: How to use TypeMap correctly?

There's a new method .getCurrentConnection() you can use to get the
connection currently in use, whether you used .startTransaction() or
.setUserTransaction().

Clinton

On 6/5/07, Yu, Jack <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>         We are trying to handle custom types (such as Oracle Object),
> the only way we find out now is to
>         get the connection instance from 
SqlMapper.getDataSource().getConnection(),
>
>         and set the typeMap in that connection, and set it back using
> SqlMapper.setUserConnection.
>
>         The API document  says:
>
>         "Using a user supplied connection basically sidesteps the
> transaction manager,
>     so you are responsible for appropriately "
>
>         The reason that we call "setUserConnection" is that SqlMapper
> will eventually use "userConnection"
>         to perform the SQL transactions, and SqlMapper.getUserConnectionis 
deprecated, and
>         "userConnection" value is not the same as
> SqlMapper.getDataSource().getConnection(). What's the magic
>         reason under that??
>
>         is there any better way to handle it?
>
>         Thanks
>
>         -- Jack
>
>

Reply via email to