Because the project that is currently ready to start uses mybatis, it is unavoidable to use the MyBatis Generator tool to generate map,entity directly from the database. However, in the use of the process, the original MyBatis generator have a lot of shortcomings, each time to start a separate start, not in eclipse through the plug-in startup; it is not possible to write database annotations to a file is the biggest problem. But I want to directly with the database Chinese comments Eclipse plug-in, looking for a long time did not find, only to find the Pineapple Elephant http://www.blogjava.net/bolo/category/54755.html article, His article detailed explained how to modify the source code to achieve their own settings to build the database comments, only according to his own method to get the plug-in.
Because of the way the annotation and the elephant is a bit different, so according to the elephant's method to modify the source file, some comments changed to//form rather than/**/form. However, following his article to correct the relevant files, the generation is still a problem, so he directly overwrites his source Files MyBatis Generator tool source files, test success, no problem.
But because I'm lazy, I want to put the MyBatis generator tool directly inside the eclipse plugin so that I can operate directly in eclipse without having to reopen it. Began to think of is directly the tool is not plug-in the jar directly into the name of the plug-in, testing is not a problem, but in the Plug-ins view of the plug-in is not visible, Determined to prepare the Mybatis-generator-1.3.2-eclipse plug-in in accordance with his method to change, should be able to use, through a variety of attempts to finally solve the problem of Chinese notes, the process to share.
First copy the original Mybatis-generator-1.3.2-eclipse plugin to the Eclipse installation directory, overwriting the features and plugins directories and entering Eclipse-->window-->show VIESW, select
Plug-ins, will be shown in the section below Eclipse, find the plugin, right click on InPort as Source Project
You can see that the Org.mybatis.generator.core project is generated on the left
Here you can modify the relevant Java source files according to your own needs, or overwrite the local source file copy directly. After the modification is complete, right-click the project file export, select deployable Plug-ins and Fragments
Next, select the second item
Options tab bar selection, not in accordance with the selected export of Chinese notes will always appear garbled, Bo Master comparison dishes, tried for a long time to find the problem here.
Finish after export is a zip compressed file, and then the file inside the 2. Jar overlay to the plugins directory is ready.
And remember to add this sentence in the Generatorconfig.xml file <property name= "javafileencoding" value= "UTF-8"/>. Test OK.
Mybatis generator Generate domain field with database comments