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 Jiming Liu <ji...@gmail.com> on 2008/08/06 08:09:12 UTC

[Feature request] add one more parameter to execute sql method

Hi Clinton,

I have been thinking about defined a sharding architecture for a while by
using iBatis. And I found if iBatis core lib could add some serveral more
methods, it would be more helpful. As following,

Object     insert(String statementName, Object parameterObject, Object
sharding)
Object     queryForObject(String statementName, Object parameterObject,
Object sharding)
...
...
and so on

and in the xml file

  <insert id="insertOrgType" parameterClass="OrgType">
    INSERT INTO dic_org_type$sharding.suffix$ (
      id
      , status
      , code
      , name
      , short_name
    ) VALUES (
      #id#
      , #status#
      , #id#
      , #name#
      , #shortName#
    )
  </insert>


Of course, I can wrap "parameterObject" and "sharding" into a map then
passed in as a whole parameter object. But that is ugly, isn't it?

Thanks!

Jiming

Re: [Feature request] add one more parameter to execute sql method

Posted by Jiming Liu <ji...@gmail.com>.
ok, thanks:)

On Wed, Aug 6, 2008 at 9:49 PM, Clinton Begin <cl...@gmail.com>wrote:

> Well just don't call it "parameterObject" ... "param" or even just "p" is
> fine.  It's not like it can be easily confused with anything else.  :-)
>
> Clinton
>
>
> On Wed, Aug 6, 2008 at 4:31 AM, Jiming Liu <ji...@gmail.com> wrote:
>
>> I still think add one more parameters is better. As using parameterClass
>> as a map  will make the xml not as nifty as it was, comparing the second xml
>> part. But anyway, put more your energy in the more important features.
>> Really looking forward to the 3.0 release .......
>>
>> Thanks a lot!
>>
>> Jiming
>>
>>   <insert id="insertOrgType" parameterClass="Map">
>>     INSERT INTO dic_org_type$sharding.suffix$ (
>>       id
>>       , status
>>       , code
>>       , name
>>       , short_name
>>     ) VALUES (
>>       #parameterObject.id#
>>       , #parameterObject.status#
>>       , #parameterObject.id#
>>       , #parameterObject.name#
>>       , #parameterObject.shortName#
>>     )
>>   </insert>
>>
>>
>>
>> On Wed, Aug 6, 2008 at 2:17 PM, Clinton Begin <cl...@gmail.com>wrote:
>>
>>> Insert a proxy SqlMapClient implementation that does the wrapping for
>>> you.
>>>
>>> Cheers,
>>> Clinton
>>>
>>>
>>> On Wed, Aug 6, 2008 at 12:09 AM, Jiming Liu <ji...@gmail.com> wrote:
>>>
>>>> Hi Clinton,
>>>>
>>>> I have been thinking about defined a sharding architecture for a while
>>>> by using iBatis. And I found if iBatis core lib could add some serveral more
>>>> methods, it would be more helpful. As following,
>>>>
>>>> Object     insert(String statementName, Object parameterObject, Object
>>>> sharding)
>>>> Object     queryForObject(String statementName, Object parameterObject,
>>>> Object sharding)
>>>> ...
>>>> ...
>>>> and so on
>>>>
>>>> and in the xml file
>>>>
>>>>   <insert id="insertOrgType" parameterClass="OrgType">
>>>>     INSERT INTO dic_org_type$sharding.suffix$ (
>>>>       id
>>>>       , status
>>>>       , code
>>>>       , name
>>>>       , short_name
>>>>     ) VALUES (
>>>>       #id#
>>>>       , #status#
>>>>       , #id#
>>>>       , #name#
>>>>       , #shortName#
>>>>     )
>>>>   </insert>
>>>>
>>>>
>>>> Of course, I can wrap "parameterObject" and "sharding" into a map then
>>>> passed in as a whole parameter object. But that is ugly, isn't it?
>>>>
>>>> Thanks!
>>>>
>>>> Jiming
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Re: [Feature request] add one more parameter to execute sql method

Posted by Clinton Begin <cl...@gmail.com>.
Well just don't call it "parameterObject" ... "param" or even just "p" is
fine.  It's not like it can be easily confused with anything else.  :-)

Clinton

On Wed, Aug 6, 2008 at 4:31 AM, Jiming Liu <ji...@gmail.com> wrote:

> I still think add one more parameters is better. As using parameterClass as
> a map  will make the xml not as nifty as it was, comparing the second xml
> part. But anyway, put more your energy in the more important features.
> Really looking forward to the 3.0 release .......
>
> Thanks a lot!
>
> Jiming
>
>   <insert id="insertOrgType" parameterClass="Map">
>     INSERT INTO dic_org_type$sharding.suffix$ (
>       id
>       , status
>       , code
>       , name
>       , short_name
>     ) VALUES (
>       #parameterObject.id#
>       , #parameterObject.status#
>       , #parameterObject.id#
>       , #parameterObject.name#
>       , #parameterObject.shortName#
>     )
>   </insert>
>
>
>
> On Wed, Aug 6, 2008 at 2:17 PM, Clinton Begin <cl...@gmail.com>wrote:
>
>> Insert a proxy SqlMapClient implementation that does the wrapping for
>> you.
>>
>> Cheers,
>> Clinton
>>
>>
>> On Wed, Aug 6, 2008 at 12:09 AM, Jiming Liu <ji...@gmail.com> wrote:
>>
>>> Hi Clinton,
>>>
>>> I have been thinking about defined a sharding architecture for a while by
>>> using iBatis. And I found if iBatis core lib could add some serveral more
>>> methods, it would be more helpful. As following,
>>>
>>> Object     insert(String statementName, Object parameterObject, Object
>>> sharding)
>>> Object     queryForObject(String statementName, Object parameterObject,
>>> Object sharding)
>>> ...
>>> ...
>>> and so on
>>>
>>> and in the xml file
>>>
>>>   <insert id="insertOrgType" parameterClass="OrgType">
>>>     INSERT INTO dic_org_type$sharding.suffix$ (
>>>       id
>>>       , status
>>>       , code
>>>       , name
>>>       , short_name
>>>     ) VALUES (
>>>       #id#
>>>       , #status#
>>>       , #id#
>>>       , #name#
>>>       , #shortName#
>>>     )
>>>   </insert>
>>>
>>>
>>> Of course, I can wrap "parameterObject" and "sharding" into a map then
>>> passed in as a whole parameter object. But that is ugly, isn't it?
>>>
>>> Thanks!
>>>
>>> Jiming
>>>
>>>
>>>
>>>
>>>
>>
>

Re: [Feature request] add one more parameter to execute sql method

Posted by Jiming Liu <ji...@gmail.com>.
I still think add one more parameters is better. As using parameterClass as
a map  will make the xml not as nifty as it was, comparing the second xml
part. But anyway, put more your energy in the more important features.
Really looking forward to the 3.0 release .......

Thanks a lot!

Jiming

  <insert id="insertOrgType" parameterClass="Map">
    INSERT INTO dic_org_type$sharding.suffix$ (
      id
      , status
      , code
      , name
      , short_name
    ) VALUES (
      #parameterObject.id#
      , #parameterObject.status#
      , #parameterObject.id#
      , #parameterObject.name#
      , #parameterObject.shortName#
    )
  </insert>


On Wed, Aug 6, 2008 at 2:17 PM, Clinton Begin <cl...@gmail.com>wrote:

> Insert a proxy SqlMapClient implementation that does the wrapping for you.
>
>
> Cheers,
> Clinton
>
>
> On Wed, Aug 6, 2008 at 12:09 AM, Jiming Liu <ji...@gmail.com> wrote:
>
>> Hi Clinton,
>>
>> I have been thinking about defined a sharding architecture for a while by
>> using iBatis. And I found if iBatis core lib could add some serveral more
>> methods, it would be more helpful. As following,
>>
>> Object     insert(String statementName, Object parameterObject, Object
>> sharding)
>> Object     queryForObject(String statementName, Object parameterObject,
>> Object sharding)
>> ...
>> ...
>> and so on
>>
>> and in the xml file
>>
>>   <insert id="insertOrgType" parameterClass="OrgType">
>>     INSERT INTO dic_org_type$sharding.suffix$ (
>>       id
>>       , status
>>       , code
>>       , name
>>       , short_name
>>     ) VALUES (
>>       #id#
>>       , #status#
>>       , #id#
>>       , #name#
>>       , #shortName#
>>     )
>>   </insert>
>>
>>
>> Of course, I can wrap "parameterObject" and "sharding" into a map then
>> passed in as a whole parameter object. But that is ugly, isn't it?
>>
>> Thanks!
>>
>> Jiming
>>
>>
>>
>>
>>
>

Re: [Feature request] add one more parameter to execute sql method

Posted by Clinton Begin <cl...@gmail.com>.
Insert a proxy SqlMapClient implementation that does the wrapping for you.

Cheers,
Clinton

On Wed, Aug 6, 2008 at 12:09 AM, Jiming Liu <ji...@gmail.com> wrote:

> Hi Clinton,
>
> I have been thinking about defined a sharding architecture for a while by
> using iBatis. And I found if iBatis core lib could add some serveral more
> methods, it would be more helpful. As following,
>
> Object     insert(String statementName, Object parameterObject, Object
> sharding)
> Object     queryForObject(String statementName, Object parameterObject,
> Object sharding)
> ...
> ...
> and so on
>
> and in the xml file
>
>   <insert id="insertOrgType" parameterClass="OrgType">
>     INSERT INTO dic_org_type$sharding.suffix$ (
>       id
>       , status
>       , code
>       , name
>       , short_name
>     ) VALUES (
>       #id#
>       , #status#
>       , #id#
>       , #name#
>       , #shortName#
>     )
>   </insert>
>
>
> Of course, I can wrap "parameterObject" and "sharding" into a map then
> passed in as a whole parameter object. But that is ugly, isn't it?
>
> Thanks!
>
> Jiming
>
>
>
>
>