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 "Yu, Jack" <Ja...@fmr.com> on 2007/06/05 23:05:20 UTC
How to use TypeMap correctly?
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.getUserConnection is 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
Re: How to use TypeMap correctly?
Posted by Clinton Begin <cl...@gmail.com>.
You have to call either startTransaction or setUserConnection to call
getCurrentConnection, yes.
Cheers,
Clinton
On 6/11/07, Yu, Jack <Ja...@fmr.com> 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:clinton.begin@gmail.com]
> *Sent:* Friday, June 08, 2007 9:25 AM
> *To:* user-java@ibatis.apache.org
> *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 <Ja...@fmr.com> 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
> >
> >
>
RE: How to use TypeMap correctly?
Posted by "Yu, Jack" <Ja...@fmr.com>.
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:clinton.begin@gmail.com]
Sent: Friday, June 08, 2007 9:25 AM
To: user-java@ibatis.apache.org
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 <Ja...@fmr.com> 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.getUserConnection is 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
Re: How to use TypeMap correctly?
Posted by Clinton Begin <cl...@gmail.com>.
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 <Ja...@fmr.com> 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
>
>