emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

iBatis 2.x -> MyBatis 3.0 conversion script #101

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Attaching a script to help migrate from iBatis.
You might want to add this to the wiki.
resultMap result/association/collection sorting must be performed manually.

Original issue reported on code.google.com by arkadi.s...@gmail.com on 13 Sep 2010 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks a lot for your contribution, looking forward to commit it on mybatis 
subproject.
Can you attach please 2-doc-line just to explain how does it work? Thanks in 
advance!
Well done!!!

Original comment by simone.t...@gmail.com on 14 Sep 2010 at 5:26

GoogleCodeExporter commented 9 years ago
Run the script as
perl ibatis-mybatis.pl < map.xml > map-ibatis3.xml
You'll get almost working map in map-ibatis3.xml.
The script perform a bunch of regexp substitutions, so if you know regexp, 
you'll have no problems tweaking the script.
If you uncomment lines 8-10 it will print map's typeAliase-s to stderr (which 
should be moved to <configuration>)
for f in orig/*.xml; do perl ibatis-mybatis.pl < $f >$(basename $f) 
2>>aliases.xml; done
You can also add another line to the script to handle selectKey-s without 
explicit order. Our Oracle insert maps (with "select tbl_seq.nextval from dual" 
inside) stopped working until BEFORE was specified:
s|<selectKey |<selectKey order="BEFORE"|g;

On a side note: you might want to amend the manual to indicate that the 
selectKey default if AFTER.

Original comment by arkadi.s...@gmail.com on 14 Sep 2010 at 7:07

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 5 Feb 2012 at 1:54

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 5 Feb 2012 at 1:55

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 5 Feb 2012 at 1:58