Recently been busy working or looking for work status, long time no write something, today idle to Nothing, record the use of mybatis-generator automatically generated DAO, Model, mapping related files steps.
We all know that hibernate belongs to the automatic Orm,mybatis is semi-automatic ORM, as to the difference between the two, there are a lot of information on the Internet, I do not describe here. In the MyBatis framework use, the most effort is to write mapping mapping files, because manual writing is easy to make mistakes, we can use Mybatis-generator to help us automatically generate files.
1. File download
Mybatis-generator:https://files.cnblogs.com/files/wq-code/mybatis-generator-core-1.3.2.zip
After decompression
2. Modify the file
Just download the file is not available to use, need to make some changes
In the case of MySQL, there are comments in the text, I will not say more, direct next.
3. Automatic generation
Double-click the Cmd.exe file, paste the corresponding statement in the document, and enter.
To a folder of your own writing, copy the generated files to your project projects
4. Wrap Up
At this point, mybatis-generator automatic generation of DAO, Model, mapping related files on the end of the introduction, but the project is just beginning, continue to work hard!
The mountain has the peak, the sea has the other shore, the long distance, finally has the turn, the aftertaste is bitter, finally has the return GAN.
Automatic generation of DAO, Model, mapping related files using Mybatis-generator