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 Jeff Butler <je...@gmail.com> on 2010/05/07 16:11:08 UTC

Re: Converting ibator generated clause in iBATIS 2 to iBATIS 3.0

There's nothing automatic.  The easiest thing to do is regenerate the
the code with the (as yet unreleased) new version of Ibator.  It's
very easy to build with Maven - I'm just struggling to find time to
deal with the all too cumbersome Apache release process.

I've done some thinking about an ibatis2->ibatis3 XML conversion tool
- but it's a very difficult thing to do because the dynamic SQL
elements are very different.  There's no easy answer for that.

Jeff Butler




On Thu, May 6, 2010 at 11:56 PM, Don's Email <do...@sbcglobal.net> wrote:
> I used ibator 1.2 to create the SQL mapper files for a project.  I am trying
> to convert the mapper files to iBATIS 3.0, but am stuck on the <iterate>
> tags.  Are there any examples available or a How to for converting mapper
> files to iBATIS 3.0?
>
>  <sql id="abatorgenerated_Example_Where_Clause">
>    <!--
>      WARNING - This element is automatically generated by Abator for
> iBATIS, do not modify.
>      This element was generated on Sat Oct 25 15:05:38 PDT 2008.
>    -->
>    <iterate conjunction="or" prepend="where" property="oredCriteria"
> removeFirstPrepend="iterate">
>      <isEqual compareValue="true" property="oredCriteria[].valid">
>        (
>        <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithoutValue">
>          $oredCriteria[].criteriaWithoutValue[]$
>        </iterate>
>        <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithSingleValue">
>          $oredCriteria[].criteriaWithSingleValue[].condition$
>            #oredCriteria[].criteriaWithSingleValue[].value#
>        </iterate>
>        <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithListValue">
>          $oredCriteria[].criteriaWithListValue[].condition$
>          <iterate close=")" conjunction="," open="("
> property="oredCriteria[].criteriaWithListValue[].values">
>            #oredCriteria[].criteriaWithListValue[].values[]#
>          </iterate>
>        </iterate>
>        <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithBetweenValue">
>          $oredCriteria[].criteriaWithBetweenValue[].condition$
>          #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
>          #oredCriteria[].criteriaWithBetweenValue[].values[1]#
>        </iterate>
>        )
>      </isEqual>
>    </iterate>
>  </sql>
>
> Thank you!
>
> Don
>
>
> ---------------------------------------------------------------------
> 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: ibator download

Posted by Roy Bailey <te...@roybailey.info>.
Thanks Jeff,

I like the fact that Ibator will give me compile time errors for 
data-model changes, especially as Ibatis is great for legacy databases 
and I use it to help any re-design evolutions.  I actually have my build 
process include full Ibator regeneration and search/replace 
automatically.  Crude, but FFP.

I expect the Interface rabbit hole would include the mix of nested 
concrete Classes returning Interfaces.  Yeah, nice in theory.

Appreciate the response...Roy


On 20/05/2010 22:27, Jeff Butler wrote:
> I usually add these types of methods directly to the generated
> classes.  In my experience, it's pretty rare to have to regenerate
> classes.  If you use Ibator through the eclipse plugin, then the added
> methods will even survive a regeneration.  Here's documentation for
> building a new version of the Eclipse plugin if you are interested:
>
> http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html
>
> I'd not recommend the interfaces route - I went down that rabbit hole
> myself onetime and lived to regret it.
>
> Search/replace - tedious but effective.
>
> Jeff Butler
>
>
>
> On Wed, May 19, 2010 at 4:30 PM, Roy Bailey<te...@roybailey.info>  wrote:
>    
>> Thanks Jeff,
>>
>> I've been able to follow the instructions and generate Ibatis 3 mappers from
>> Ibator 1.2.2 build.  Great job.
>>
>> I've also been looking around the Ibator code because I want to use extended
>> classes for result-sets (e.g. classes that extend the Ibator generated
>> classes and add derived methods and/or nice toString() etc.).  Easiest way
>> seems to be to search/replace the code generated with different package,
>> where I define the extended versions.  Another thought was to generate/use
>> interfaces with all the getter/setter type methods, as this would allow for
>> other classes to be passed to native Ibator mappers instead of forcing the
>> creation/population of Ibator concrete classes.  Low priority, but any
>> suggestions or thoughts?
>>
>> regards...
>> Roy
>>
>>
>> On 10/05/2010 22:43, Jeff Butler wrote:
>>      
>>> "stable" is strictly in the opinion of the user :)  I've been using it
>>> for many weeks and it seems stable to me.
>>>
>>> Honestly, I don't know when I'll get to publishing it.  Whenever I
>>> give a date, I miss it by a mile - for lots of reasons, mainly that it
>>> takes more time than I seem to have.
>>>
>>> It's very easy to build yourself with Maven.  I wrote some directions
>>> here:
>>>
>>>
>>> http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html
>>>
>>> Jeff Butler
>>>
>>>
>>>
>>> On Mon, May 10, 2010 at 4:31 PM, Roy Bailey<te...@roybailey.info>    wrote:
>>>
>>>        
>>>> Any idea when a version of Ibator for iBatis 3 will be ready for
>>>> download?
>>>>
>>>> I'd be really interested in stable milestone of the ibator to go with the
>>>> testing of iBatis 3, especially as I'm starting to spend a lot of time on
>>>> basic table crud.
>>>>
>>>> thanks...Roy
>>>> P.S. I don't use maven, but if the instructions are simple I can give it
>>>> a
>>>> go.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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: ibator download

Posted by Jeff Butler <je...@gmail.com>.
I usually add these types of methods directly to the generated
classes.  In my experience, it's pretty rare to have to regenerate
classes.  If you use Ibator through the eclipse plugin, then the added
methods will even survive a regeneration.  Here's documentation for
building a new version of the Eclipse plugin if you are interested:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/eclipse/org.apache.ibatis.ibator.eclipse.doc/html-src/eclipseui/buildingFromSVN.html

I'd not recommend the interfaces route - I went down that rabbit hole
myself onetime and lived to regret it.

Search/replace - tedious but effective.

Jeff Butler



On Wed, May 19, 2010 at 4:30 PM, Roy Bailey <te...@roybailey.info> wrote:
> Thanks Jeff,
>
> I've been able to follow the instructions and generate Ibatis 3 mappers from
> Ibator 1.2.2 build.  Great job.
>
> I've also been looking around the Ibator code because I want to use extended
> classes for result-sets (e.g. classes that extend the Ibator generated
> classes and add derived methods and/or nice toString() etc.).  Easiest way
> seems to be to search/replace the code generated with different package,
> where I define the extended versions.  Another thought was to generate/use
> interfaces with all the getter/setter type methods, as this would allow for
> other classes to be passed to native Ibator mappers instead of forcing the
> creation/population of Ibator concrete classes.  Low priority, but any
> suggestions or thoughts?
>
> regards...
> Roy
>
>
> On 10/05/2010 22:43, Jeff Butler wrote:
>>
>> "stable" is strictly in the opinion of the user :)  I've been using it
>> for many weeks and it seems stable to me.
>>
>> Honestly, I don't know when I'll get to publishing it.  Whenever I
>> give a date, I miss it by a mile - for lots of reasons, mainly that it
>> takes more time than I seem to have.
>>
>> It's very easy to build yourself with Maven.  I wrote some directions
>> here:
>>
>>
>> http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html
>>
>> Jeff Butler
>>
>>
>>
>> On Mon, May 10, 2010 at 4:31 PM, Roy Bailey<te...@roybailey.info>  wrote:
>>
>>>
>>> Any idea when a version of Ibator for iBatis 3 will be ready for
>>> download?
>>>
>>> I'd be really interested in stable milestone of the ibator to go with the
>>> testing of iBatis 3, especially as I'm starting to spend a lot of time on
>>> basic table crud.
>>>
>>> thanks...Roy
>>> P.S. I don't use maven, but if the instructions are simple I can give it
>>> a
>>> go.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: ibator download

Posted by Roy Bailey <te...@roybailey.info>.
Thanks Jeff,

I've been able to follow the instructions and generate Ibatis 3 mappers 
from Ibator 1.2.2 build.  Great job.

I've also been looking around the Ibator code because I want to use 
extended classes for result-sets (e.g. classes that extend the Ibator 
generated classes and add derived methods and/or nice toString() etc.).  
Easiest way seems to be to search/replace the code generated with 
different package, where I define the extended versions.  Another 
thought was to generate/use interfaces with all the getter/setter type 
methods, as this would allow for other classes to be passed to native 
Ibator mappers instead of forcing the creation/population of Ibator 
concrete classes.  Low priority, but any suggestions or thoughts?

regards...
Roy


On 10/05/2010 22:43, Jeff Butler wrote:
> "stable" is strictly in the opinion of the user :)  I've been using it
> for many weeks and it seems stable to me.
>
> Honestly, I don't know when I'll get to publishing it.  Whenever I
> give a date, I miss it by a mile - for lots of reasons, mainly that it
> takes more time than I seem to have.
>
> It's very easy to build yourself with Maven.  I wrote some directions here:
>
> http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html
>
> Jeff Butler
>
>
>
> On Mon, May 10, 2010 at 4:31 PM, Roy Bailey<te...@roybailey.info>  wrote:
>    
>> Any idea when a version of Ibator for iBatis 3 will be ready for download?
>>
>> I'd be really interested in stable milestone of the ibator to go with the
>> testing of iBatis 3, especially as I'm starting to spend a lot of time on
>> basic table crud.
>>
>> thanks...Roy
>> P.S. I don't use maven, but if the instructions are simple I can give it a
>> go.
>>
>>
>> ---------------------------------------------------------------------
>> 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: ibator download

Posted by Jeff Butler <je...@gmail.com>.
"stable" is strictly in the opinion of the user :)  I've been using it
for many weeks and it seems stable to me.

Honestly, I don't know when I'll get to publishing it.  Whenever I
give a date, I miss it by a mile - for lots of reasons, mainly that it
takes more time than I seem to have.

It's very easy to build yourself with Maven.  I wrote some directions here:

http://svn.apache.org/repos/asf/ibatis/java/ibator/trunk/core/ibator-core/doc/html/reference/building.html

Jeff Butler



On Mon, May 10, 2010 at 4:31 PM, Roy Bailey <te...@roybailey.info> wrote:
> Any idea when a version of Ibator for iBatis 3 will be ready for download?
>
> I'd be really interested in stable milestone of the ibator to go with the
> testing of iBatis 3, especially as I'm starting to spend a lot of time on
> basic table crud.
>
> thanks...Roy
> P.S. I don't use maven, but if the instructions are simple I can give it a
> go.
>
>
> ---------------------------------------------------------------------
> 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


ibator download

Posted by Roy Bailey <te...@roybailey.info>.
Any idea when a version of Ibator for iBatis 3 will be ready for download?

I'd be really interested in stable milestone of the ibator to go with 
the testing of iBatis 3, especially as I'm starting to spend a lot of 
time on basic table crud.

thanks...Roy
P.S. I don't use maven, but if the instructions are simple I can give it 
a go.


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


RE: Converting ibator generated clause in iBATIS 2 to iBATIS 3.0

Posted by Don Clary <do...@sbcglobal.net>.
Thanks for the info Jeff!  I do not have a deadline for having to switch to
iBATIS 3.0.  I can wait until the new version of Ibator is released and then
regen the mapper files.  I'll continue to study the dynamic SQL described in
iBATIS 3.0, when I have time.

Don Clary

> -----Original Message-----
> From: Jeff Butler [mailto:jeffgbutler@gmail.com]
> Sent: Friday, May 07, 2010 7:11 AM
> To: user-java@ibatis.apache.org
> Subject: Re: Converting ibator generated <iterate> clause in iBATIS 2 to
> iBATIS 3.0
>
>
> There's nothing automatic.  The easiest thing to do is regenerate the
> the code with the (as yet unreleased) new version of Ibator.  It's
> very easy to build with Maven - I'm just struggling to find time to
> deal with the all too cumbersome Apache release process.
>
> I've done some thinking about an ibatis2->ibatis3 XML conversion tool
> - but it's a very difficult thing to do because the dynamic SQL
> elements are very different.  There's no easy answer for that.
>
> Jeff Butler
>
>
>
>
> On Thu, May 6, 2010 at 11:56 PM, Don's Email
> <do...@sbcglobal.net> wrote:
> > I used ibator 1.2 to create the SQL mapper files for a project.
>  I am trying
> > to convert the mapper files to iBATIS 3.0, but am stuck on the <iterate>
> > tags.  Are there any examples available or a How to for
> converting mapper
> > files to iBATIS 3.0?
> >
> >  <sql id="abatorgenerated_Example_Where_Clause">
> >    <!--
> >      WARNING - This element is automatically generated by Abator for
> > iBATIS, do not modify.
> >      This element was generated on Sat Oct 25 15:05:38 PDT 2008.
> >    -->
> >    <iterate conjunction="or" prepend="where" property="oredCriteria"
> > removeFirstPrepend="iterate">
> >      <isEqual compareValue="true" property="oredCriteria[].valid">
> >        (
> >        <iterate conjunction="and" prepend="and"
> > property="oredCriteria[].criteriaWithoutValue">
> >          $oredCriteria[].criteriaWithoutValue[]$
> >        </iterate>
> >        <iterate conjunction="and" prepend="and"
> > property="oredCriteria[].criteriaWithSingleValue">
> >          $oredCriteria[].criteriaWithSingleValue[].condition$
> >            #oredCriteria[].criteriaWithSingleValue[].value#
> >        </iterate>
> >        <iterate conjunction="and" prepend="and"
> > property="oredCriteria[].criteriaWithListValue">
> >          $oredCriteria[].criteriaWithListValue[].condition$
> >          <iterate close=")" conjunction="," open="("
> > property="oredCriteria[].criteriaWithListValue[].values">
> >            #oredCriteria[].criteriaWithListValue[].values[]#
> >          </iterate>
> >        </iterate>
> >        <iterate conjunction="and" prepend="and"
> > property="oredCriteria[].criteriaWithBetweenValue">
> >          $oredCriteria[].criteriaWithBetweenValue[].condition$
> >          #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
> >          #oredCriteria[].criteriaWithBetweenValue[].values[1]#
> >        </iterate>
> >        )
> >      </isEqual>
> >    </iterate>
> >  </sql>
> >
> > Thank you!
> >
> > Don
> >
> >
> > ---------------------------------------------------------------------
> > 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