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 Tomáš Procházka <t....@centrum.cz> on 2009/11/15 12:33:25 UTC

What I miss in Ibator (was: Re: what contain int return value for insert?)

Thanks you. This is great, only small problem is that I must define the same think to all table, but it work!

I already wrote plugin for support limiting result by RowBounds.
Here is:

http://www.atomsoft.cz/projekty/java/ibator-plugins/SelectByLimitPlugin.java

I also implementing generation default value for field. Very simple way for my needs. It can't be done by plugin so I modify ibator direclty, here is patch:
http://www.atomsoft.cz/projekty/java/ibator-plugins/defaultFieldValue.patch

You can use it as can.


I already miss only support for foreign key for automatic generation something like this:

<resultMap id=”blogResult” type=”Blog”>
  ....
  <association property="author" column="blog_author_id" javaType="Author" 
select=”selectAuthor”/>
</resultMap>

______________________________________________________________
> Od: "Jeff Butler" <je...@gmail.com>
> Komu: user-java@ibatis.apache.org
> Datum: 14.11.2009 22:12
> Předmět: Re: what contain int return value for insert?
>
>The return value from the insert method is the number of rows inserted
>(in iBATIS3).
>
>Ibator will generated the proper code for generated keys - see the
><generatedKey> configuration element in the documentation.
>
>Jeff Butler
>
>
>2009/11/14 Tomáš Procházka <t....@centrum.cz>:
>>
>> What contain return int value for this mapper method:
>>
>> int insert(Group record);
>>
>> with this mapping delcaration:
>>
>>  <insert id="insert" parameterType="test.model.Group" >
>>    insert into `group` (id, name, type,
>>      locked, lockedby_user)
>>    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=CHAR},
>>      #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})
>>  </insert>
>>
>> ?
>>
>> A prefer automatically return last insert id, it's possible?
>>
>> I tried this:
>>
>>                <selectKey keyProperty="id" resultType="integer">
>>                         SELECT LAST_INSERT_ID();
>>                </selectKey>
>>
>> It update field in Group instance which was used to call insert method, But has no result to insert method return value.
>>
>>
>>                <selectKey keyProperty="id" resultType="integer"> SELECT LAST_INSERT_ID();</selectKey>
>>
>> This should be automatically generated by Ibator. It's very important for easy way to build related DB data.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: What I miss in Ibator (was: Re: what contain int return value for insert?)

Posted by Tomáš Procházka <t....@centrum.cz>.
Thanks you.

Here is plugin:
http://www.atomsoft.cz/projekty/java/ibator-plugins/ModelFieldsDefaulValuesFromDb.java

______________________________________________________________
> Od: "Jeff Butler" <je...@gmail.com>
> Komu: user-java@ibatis.apache.org
> Datum: 15.11.2009 21:23
> Předmět: Re: What I miss in Ibator (was: Re: what contain int return value for insert?)
>
>I used part of your patch for column defaults - I added to attribute
>in the introspected column and filled it in with the database
>introspector.  You can do the rest of your patch with a plugin.
>
>Thanks!
>Jeff Butler
>
>
>2009/11/15 Tomáš Procházka <t....@centrum.cz>:
>>
>> Thanks you. This is great, only small problem is that I must define the same think to all table, but it work!
>>
>> I already wrote plugin for support limiting result by RowBounds.
>> Here is:
>>
>> http://www.atomsoft.cz/projekty/java/ibator-plugins/SelectByLimitPlugin.java
>>
>> I also implementing generation default value for field. Very simple way for my needs. It can't be done by plugin so I modify ibator direclty, here is patch:
>> http://www.atomsoft.cz/projekty/java/ibator-plugins/defaultFieldValue.patch
>>
>> You can use it as can.
>>
>>
>> I already miss only support for foreign key for automatic generation something like this:
>>
>> <resultMap id="blogResult" type="Blog">
>>  ....
>>  <association property="author" column="blog_author_id" javaType="Author"
>> select="selectAuthor"/>
>> </resultMap>
>>
>> ______________________________________________________________
>>> Od: "Jeff Butler" <je...@gmail.com>
>>> Komu: user-java@ibatis.apache.org
>>> Datum: 14.11.2009 22:12
>>> Předmět: Re: what contain int return value for insert?
>>>
>>>The return value from the insert method is the number of rows inserted
>>>(in iBATIS3).
>>>
>>>Ibator will generated the proper code for generated keys - see the
>>><generatedKey> configuration element in the documentation.
>>>
>>>Jeff Butler
>>>
>>>
>>>2009/11/14 Tomáš Procházka <t....@centrum.cz>:
>>>>
>>>> What contain return int value for this mapper method:
>>>>
>>>> int insert(Group record);
>>>>
>>>> with this mapping delcaration:
>>>>
>>>>  <insert id="insert" parameterType="test.model.Group" >
>>>>    insert into `group` (id, name, type,
>>>>      locked, lockedby_user)
>>>>    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=CHAR},
>>>>      #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})
>>>>  </insert>
>>>>
>>>> ?
>>>>
>>>> A prefer automatically return last insert id, it's possible?
>>>>
>>>> I tried this:
>>>>
>>>>                <selectKey keyProperty="id" resultType="integer">
>>>>                         SELECT LAST_INSERT_ID();
>>>>                </selectKey>
>>>>
>>>> It update field in Group instance which was used to call insert method, But has no result to insert method return value.
>>>>
>>>>
>>>>                <selectKey keyProperty="id" resultType="integer"> SELECT LAST_INSERT_ID();</selectKey>
>>>>
>>>> This should be automatically generated by Ibator. It's very important for easy way to build related DB data.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>>
>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: What I miss in Ibator (was: Re: what contain int return value for insert?)

Posted by Jeff Butler <je...@gmail.com>.
I used part of your patch for column defaults - I added to attribute
in the introspected column and filled it in with the database
introspector.  You can do the rest of your patch with a plugin.

Thanks!
Jeff Butler


2009/11/15 Tomáš Procházka <t....@centrum.cz>:
>
> Thanks you. This is great, only small problem is that I must define the same think to all table, but it work!
>
> I already wrote plugin for support limiting result by RowBounds.
> Here is:
>
> http://www.atomsoft.cz/projekty/java/ibator-plugins/SelectByLimitPlugin.java
>
> I also implementing generation default value for field. Very simple way for my needs. It can't be done by plugin so I modify ibator direclty, here is patch:
> http://www.atomsoft.cz/projekty/java/ibator-plugins/defaultFieldValue.patch
>
> You can use it as can.
>
>
> I already miss only support for foreign key for automatic generation something like this:
>
> <resultMap id="blogResult" type="Blog">
>  ....
>  <association property="author" column="blog_author_id" javaType="Author"
> select="selectAuthor"/>
> </resultMap>
>
> ______________________________________________________________
>> Od: "Jeff Butler" <je...@gmail.com>
>> Komu: user-java@ibatis.apache.org
>> Datum: 14.11.2009 22:12
>> Předmět: Re: what contain int return value for insert?
>>
>>The return value from the insert method is the number of rows inserted
>>(in iBATIS3).
>>
>>Ibator will generated the proper code for generated keys - see the
>><generatedKey> configuration element in the documentation.
>>
>>Jeff Butler
>>
>>
>>2009/11/14 Tomáš Procházka <t....@centrum.cz>:
>>>
>>> What contain return int value for this mapper method:
>>>
>>> int insert(Group record);
>>>
>>> with this mapping delcaration:
>>>
>>>  <insert id="insert" parameterType="test.model.Group" >
>>>    insert into `group` (id, name, type,
>>>      locked, lockedby_user)
>>>    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=CHAR},
>>>      #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})
>>>  </insert>
>>>
>>> ?
>>>
>>> A prefer automatically return last insert id, it's possible?
>>>
>>> I tried this:
>>>
>>>                <selectKey keyProperty="id" resultType="integer">
>>>                         SELECT LAST_INSERT_ID();
>>>                </selectKey>
>>>
>>> It update field in Group instance which was used to call insert method, But has no result to insert method return value.
>>>
>>>
>>>                <selectKey keyProperty="id" resultType="integer"> SELECT LAST_INSERT_ID();</selectKey>
>>>
>>> This should be automatically generated by Ibator. It's very important for easy way to build related DB data.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org