Roughly memorandum memo as usual
The DB connection destination uses the data source settings when MapperScan registered the bean in the DI container. Note that even if you switch the transactionManager of @Transactional, you will not go to connect to the DB of the data source set by the switched transactionManager.
In the case where the table structure is exactly the same but only the DB connection destination is different (when you prepare two data sources and want to access each individually), Both MapperScan for data source 1 and MapperScan for data source 2 are prepared, and it is necessary to specify sessionFactoryRef and nameGenerator separately for one of the data sources.
nameGenerator is required to prevent the generated bean name from being covered.
Specify the bean name when DI (when Autowired).
https://www.slideshare.net/tokuhirom/mybatis-web-application
eclipse plugin eclipse marketplace> Mybatipse It is almost essential because the completion will be effective when writing xml.
It is somewhat sensuous to define the properties of the relay entity in the entity class and map them. .. ??
http://kamatama41.hatenablog.com/entry/20130409/1365483365
Use ColumnOverride for Enum support http://blog.zaq.ne.jp/oboe2uran/article/1180/ http://tech-blog.tsukaby.com/archives/205
When using plugin, add a project of Plugin class by right-clicking generatorConfig.xml> Execution configuration> Classpath> Add project>
Specifying the character code of the output java file
<context>
<property name="javaFileEncoding" value="UTF-8" />
~
</context>
See FieldVisibilityProtectedPlugin.java and myBaitsGeneratorConfig.xml in the sample code
https://github.com/javaplugs/mybatis-types
http://www.mybatis.org/mybatis-3/ja/configuration.html Settings cacheEnabled
Since cache is effective by default, one transaction? Even if I throw the query that is executed once in (I forgot the detailed unit), it does not go to the DB.
If you put in the eclipse plugin and use it, overwriting works well.
See below for the location of the plugin http://www.mybatis.org/generator/running/runningWithEclipse.html
http://qiita.com/kumazo@github/items/72ecdb2923b77aaa0c94
http://atuweb.net/201602_java-mybatis-dynamic-and-fast-sql/