How to realize ibatis automatic Code Generation
This article mainly introduces how to achieve ibatis automatic code generation, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
First, obtain
Http://ibatis.apache.org/abator.html
Unpack it to the directory after download
D:\ abator-0.6.5-124
\ abator.jar
\ abator-src.zip
III. Configuration file
Create a new configuration file, config.xml, with the following contents:
Undefined
Here is the Oracle-related configuration, other databases can be analogous, where javaModelGenerator, sqlMapGenerator, daoGenerator is the relevant code will be generated, you can add or delete according to your own needs, a more complete configuration file can see the definition of DTD. Http://ibatis.apache.org/dtd/abator-config_1_0.dtd
4. Run (create a new directory test under the root directory of D disk, and you need to store the generated files)
Java-jar abator.jar config.xml false
Java-jar abator.jar config.xml true
Java-cp abator.jar org.apache.ibatis.abator.api.AbatorRunner config.xml false
Java-cp abator.jar org.apache.ibatis.abator.api.AbatorRunner config.xml true
The above four ways can be run. True/false indicates whether to overwrite the original code.
5. View the generated file and modify it
After a successful operation, you will have the following information:
Abator finshed successfully, there were warninigs
At this point, you can manually modify the generated ibatis automatic code.
Thank you for reading this article carefully. I hope the article "how to achieve ibatis automatic code generation" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!