使用Eclipse(MyEclipse)+ abator自动生成iBatis代码以及配置文...
来源:百度文库 编辑:神马文学网 时间:2024/10/03 02:52:44
从http://ibatis.apache.org/abator.html下载Eclipse Plugin。插件一共有2种安装方式,在网页上都有介绍。
2、 新建一个Eclipse项目,项目名称为myibatis,然后选择文件>新建>ABator for iBatis configuration File,选择Location,并且键入File Name:abatorCsonfig.xml。
字串6
3、 点击“完成”,Eclipse会在程序根目录下建立abatorCsonfig.xml文件,打开编辑它,内容如下:
字串7
字串8
"http://ibatis.apache.org/dtd/abator-config_1_0.dtd">
字串4
字串2
字串5
字串3
字串2 connectionURL="jdbc:oracle:thin:@210.11.11.11:1521:iisg" 字串1 userId="test" 字串5 password=" test "> 字串2 字串5
字串5
字串1
targetProject="myibatis/src" /> 字串2 字串1 字串6 targetProject="myibatis/src" /> 字串7 字串4 字串4 字串5 字串6 4、 注意中的catalog="test" schema="test",这个一定要写上,不然会报错的。 字串8
5、 在abatorCsonfig.xml上点击鼠标右键,选择Generate iBATIS Artifact,在src目录下会生成com.soho.model、com. soho.map、com. soho.dao三个目录,文件也建立好了。
字串7
6、 javaModelGenerator:我们常说的ValueObject 字串8
7、 sqlMapGenerator:XML文件 字串2
8、 daoGenerator:放置接口和DAO的代码