Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize ibatis automatic Code Generation

Shulou Source: shulou.com Published: 2022-06-02 09:19:52 10月01日 Update

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!

Tags: Generate code file article configuration directory run code generation success and so on value information interest content at the same time manual data database way more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft MariaDB Docker Shulou Tech Info