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 Sundar Sankar <fa...@gmail.com> on 2008/07/16 19:04:52 UTC

INOUT and Typehandler

Hi All,
          I am using Typehandler for Oracle user defined databases. The
typehandler seems to be invoked when the mode is "IN" and never called when
the mode is "INOUT". I saw a post mentioning a similar issue

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

I tried Larry's suggestion of changing jdbcType to "Struct" and running the
proc. The Typehandler still doesnt seem to get called. Is there something
wrong I am doing.

=========
My Configs
=========

1. In SQLMap Config

<!--originally -->

<typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"  />

<!-- Changed to -->

<typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
jdbcType="STRUCT"  />

2.  SQLMAp File

<!-- originally -->

<parameter property="propertyName"
jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"
            javaType="myTypehandlerModell" mode="INOUT" />

<!-- Changed to -->

<parameter property="propertyName" jdbcType="STRUCT"
            javaType="myTypehandlerModell" mode="INOUT"
typeName="ORACLEDATABASEUSERDEFINEDTYPENAME"/>

What am I Doing wrong here??

-Sundar

Question(s) about DAO setup - possible Throttle deadlock?

Posted by Brian Parkinson <pa...@avaning.com>.
Hello:
 
Hoping someone can help - I am running into what appears to be a
deadlock issue, and starting to investigate, but I thought I'd pop a
question or two out to see if anyone can help.
 
1. Is it bad practice for a Dao implementation to call another? I use
Spring to set everything up (see below). In one Dao object which
controls the Foo table, I also want to update the Bar table, so I am
doing:
 
public class FooDao extends SqlMapClientDaoSupport implements IFooDao
{
  final private static IBarDao BAR_DAO = (IBarDao)
getSpringContext().getBean("barDao)";
 
This way, in my save and update method, I can call to the BAR_DAO to
update that table.
 
Is this bad? Any hints on best practices here appreciated.
 
2. As noted above, I have seen some deadlock (and hence wondering
whether question #1 might be related) - when I looked at blocked
threads, I noted some references to the iBATIS Throttle object, and have
seen some articles related to this. I am using iBATIS verison 2.3.0.677
- should I upgrade?
 
3. My config set up is below - this seems to be all correct but
wondering if I've missed anything, or have anything set up obviously
wrong.
 
Any help is appreciated - regards,
 
Brian Parkinson
Avaning Inc.
parki@avaning.com
 
--- x8 snip
 
 <bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
  <property name="dataSource" ref="dataSource"/>
 </bean>
 
 <tx:advice id="txAdvice" transaction-manager="txManager">
  <tx:attributes>
   <tx:method name="get*" read-only="true" />
   <tx:method name="*" />
  </tx:attributes>
 </tx:advice>
 
 <aop:config>
  <aop:pointcut id="daoServiceOperation" expression="execution(*
com.ecobee.foundation.dao.ibatis.*.*(..))" />
  <aop:advisor advice-ref="txAdvice" pointcut-ref="daoServiceOperation"
/>
 </aop:config>
 
 <bean id="mapConfig"
class="org.springframework.core.io.ClassPathResource">
  <constructor-arg>
   <value>com/ecobee/foundation/dao/ibatis/SqlMapConfig.xml</value>
  </constructor-arg>
 </bean>
  
 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql:///ecobee" />
  <property name="username" value="XXX" />
  <property name="password" value="XXX" /> 
  <property name="initialSize" value="10" />
  <property name="maxActive" value="100" /> 
  <property name="maxIdle" value="10" />
 </bean>
 
 <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="configLocation" ref="mapConfig" />
 </bean>
 
 <bean id="fooDao" class="com.ecobee.foundation.dao.ibatis.FooDao">
  <property name="sqlMapClient" ref="sqlMapClient" />
 </bean>
 
 <bean id="barDao" class="com.ecobee.foundation.dao.ibatis.BarDao">
  <property name="sqlMapClient" ref="sqlMapClient" />
 </bean>


Re: INOUT and Typehandler

Posted by Clinton Begin <cl...@gmail.com>.
I've flagged this to have a look at it, hopefully not too long before we can
at least commit it to SVN.

Cheers,
Clinton

On Fri, Aug 1, 2008 at 9:33 AM, Giovanni Cuccu <gi...@gmail.com>wrote:

> sorry, partially wrong address.
>
>
> > I created and subitted a patch today.
> > I don't know when will be accepted in the svn.
> > Giovanni
> >
> >
> > On Wed, Jul 16, 2008 at 9:56 PM, Sundar Sankar <fa...@gmail.com>
> wrote:
> >> Hi Giovanni,
> >>                 Thanks for the effort. Can you let me know when the
> patch is
> >> in, I will download the latest and try it out.
> >>
> >> Thanks
> >> -Sundar
> >>
> >> On Wed, Jul 16, 2008 at 12:33 PM, Giovanni Cuccu <
> giovanni.cuccu@gmail.com>
> >> wrote:
> >>>
> >>> Hi,
> >>>    IIRC it's not possible to map custom out oracle parameters in
> >>> iBatis. I did the investigation in the 2.3.0 code, the fix was not too
> >>> hard. I'll try to create an issue in Jira and attach a patch, but I
> >>> can't promise anything.
> >>> Giovanni
>
> --
> --------------------------------------------------------------------
> "You don't know the power of dark side" - Darth Vader
>

Re: INOUT and Typehandler

Posted by Giovanni Cuccu <gi...@gmail.com>.
sorry, partially wrong address.


> I created and subitted a patch today.
> I don't know when will be accepted in the svn.
> Giovanni
>
>
> On Wed, Jul 16, 2008 at 9:56 PM, Sundar Sankar <fa...@gmail.com> wrote:
>> Hi Giovanni,
>>                 Thanks for the effort. Can you let me know when the patch is
>> in, I will download the latest and try it out.
>>
>> Thanks
>> -Sundar
>>
>> On Wed, Jul 16, 2008 at 12:33 PM, Giovanni Cuccu <gi...@gmail.com>
>> wrote:
>>>
>>> Hi,
>>>    IIRC it's not possible to map custom out oracle parameters in
>>> iBatis. I did the investigation in the 2.3.0 code, the fix was not too
>>> hard. I'll try to create an issue in Jira and attach a patch, but I
>>> can't promise anything.
>>> Giovanni

-- 
--------------------------------------------------------------------
"You don't know the power of dark side" - Darth Vader

Re: INOUT and Typehandler

Posted by Giovanni Cuccu <gi...@gmail.com>.
I created and subitted a patch today.
I don't know when will be accepted in the svn.
Giovanni


On Wed, Jul 16, 2008 at 9:56 PM, Sundar Sankar <fa...@gmail.com> wrote:
> Hi Giovanni,
>                 Thanks for the effort. Can you let me know when the patch is
> in, I will download the latest and try it out.
>
> Thanks
> -Sundar
>
> On Wed, Jul 16, 2008 at 12:33 PM, Giovanni Cuccu <gi...@gmail.com>
> wrote:
>>
>> Hi,
>>    IIRC it's not possible to map custom out oracle parameters in
>> iBatis. I did the investigation in the 2.3.0 code, the fix was not too
>> hard. I'll try to create an issue in Jira and attach a patch, but I
>> can't promise anything.
>> Giovanni
>>
>> On Wed, Jul 16, 2008 at 7:04 PM, Sundar Sankar <fa...@gmail.com>
>> wrote:
>> > Hi All,
>> >           I am using Typehandler for Oracle user defined databases. The
>> > typehandler seems to be invoked when the mode is "IN" and never called
>> > when
>> > the mode is "INOUT". I saw a post mentioning a similar issue
>> >
>> > http://www.mail-archive.com/user-java@ibatis.apache.org/msg07216.html
>> >
>> > I tried Larry's suggestion of changing jdbcType to "Struct" and running
>> > the
>> > proc. The Typehandler still doesnt seem to get called. Is there
>> > something
>> > wrong I am doing.
>> >
>> > =========
>> > My Configs
>> > =========
>> >
>> > 1. In SQLMap Config
>> >
>> > <!--originally -->
>> >
>> > <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
>> > jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"  />
>> >
>> > <!-- Changed to -->
>> >
>> > <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
>> > jdbcType="STRUCT"  />
>> >
>> > 2.  SQLMAp File
>> >
>> > <!-- originally -->
>> >
>> > <parameter property="propertyName"
>> > jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"
>> >             javaType="myTypehandlerModell" mode="INOUT" />
>> >
>> > <!-- Changed to -->
>> >
>> > <parameter property="propertyName" jdbcType="STRUCT"
>> >             javaType="myTypehandlerModell" mode="INOUT"
>> > typeName="ORACLEDATABASEUSERDEFINEDTYPENAME"/>
>> >
>> > What am I Doing wrong here??
>> >
>> > -Sundar
>> >
>>
>>
>>
>> --
>> --------------------------------------------------------------------
>> "You don't know the power of dark side" - Darth Vader
>
>



-- 
--------------------------------------------------------------------
"You don't know the power of dark side" - Darth Vader

Re: INOUT and Typehandler

Posted by Sundar Sankar <fa...@gmail.com>.
Hi Giovanni,
                Thanks for the effort. Can you let me know when the patch is
in, I will download the latest and try it out.

Thanks
-Sundar

On Wed, Jul 16, 2008 at 12:33 PM, Giovanni Cuccu <gi...@gmail.com>
wrote:

> Hi,
>    IIRC it's not possible to map custom out oracle parameters in
> iBatis. I did the investigation in the 2.3.0 code, the fix was not too
> hard. I'll try to create an issue in Jira and attach a patch, but I
> can't promise anything.
> Giovanni
>
> On Wed, Jul 16, 2008 at 7:04 PM, Sundar Sankar <fa...@gmail.com>
> wrote:
> > Hi All,
> >           I am using Typehandler for Oracle user defined databases. The
> > typehandler seems to be invoked when the mode is "IN" and never called
> when
> > the mode is "INOUT". I saw a post mentioning a similar issue
> >
> > http://www.mail-archive.com/user-java@ibatis.apache.org/msg07216.html
> >
> > I tried Larry's suggestion of changing jdbcType to "Struct" and running
> the
> > proc. The Typehandler still doesnt seem to get called. Is there something
> > wrong I am doing.
> >
> > =========
> > My Configs
> > =========
> >
> > 1. In SQLMap Config
> >
> > <!--originally -->
> >
> > <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
> > jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"  />
> >
> > <!-- Changed to -->
> >
> > <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
> > jdbcType="STRUCT"  />
> >
> > 2.  SQLMAp File
> >
> > <!-- originally -->
> >
> > <parameter property="propertyName"
> > jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"
> >             javaType="myTypehandlerModell" mode="INOUT" />
> >
> > <!-- Changed to -->
> >
> > <parameter property="propertyName" jdbcType="STRUCT"
> >             javaType="myTypehandlerModell" mode="INOUT"
> > typeName="ORACLEDATABASEUSERDEFINEDTYPENAME"/>
> >
> > What am I Doing wrong here??
> >
> > -Sundar
> >
>
>
>
> --
> --------------------------------------------------------------------
> "You don't know the power of dark side" - Darth Vader
>

Re: INOUT and Typehandler

Posted by Giovanni Cuccu <gi...@gmail.com>.
Hi,
    IIRC it's not possible to map custom out oracle parameters in
iBatis. I did the investigation in the 2.3.0 code, the fix was not too
hard. I'll try to create an issue in Jira and attach a patch, but I
can't promise anything.
Giovanni

On Wed, Jul 16, 2008 at 7:04 PM, Sundar Sankar <fa...@gmail.com> wrote:
> Hi All,
>           I am using Typehandler for Oracle user defined databases. The
> typehandler seems to be invoked when the mode is "IN" and never called when
> the mode is "INOUT". I saw a post mentioning a similar issue
>
> http://www.mail-archive.com/user-java@ibatis.apache.org/msg07216.html
>
> I tried Larry's suggestion of changing jdbcType to "Struct" and running the
> proc. The Typehandler still doesnt seem to get called. Is there something
> wrong I am doing.
>
> =========
> My Configs
> =========
>
> 1. In SQLMap Config
>
> <!--originally -->
>
> <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
> jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"  />
>
> <!-- Changed to -->
>
> <typeHandler callback="myTypehandler" javaType="myTypehandlerModel"
> jdbcType="STRUCT"  />
>
> 2.  SQLMAp File
>
> <!-- originally -->
>
> <parameter property="propertyName"
> jdbcType="ORACLEDATABASEUSERDEFINEDTYPENAME"
>             javaType="myTypehandlerModell" mode="INOUT" />
>
> <!-- Changed to -->
>
> <parameter property="propertyName" jdbcType="STRUCT"
>             javaType="myTypehandlerModell" mode="INOUT"
> typeName="ORACLEDATABASEUSERDEFINEDTYPENAME"/>
>
> What am I Doing wrong here??
>
> -Sundar
>



-- 
--------------------------------------------------------------------
"You don't know the power of dark side" - Darth Vader