【问题标题】:MyBatis Generator plugin table tagMyBatis Generator 插件表标签
【发布时间】:2013-09-30 07:43:47
【问题描述】:

博客表由与 Author 表的一对一关联组成,我的 java 类应该看起来像预期的那样。

公开课博客{

private int id;
private String name;
private String url;
private Author author;

//getter 和 setter }

公开课作者{

private int id;
private String name;
private String email;

}

我写了一个“generatorConfig.xml”如下图


</table>
<table schema="blog_ibatis" tableName="Post" >

</table>
<table schema="blog_ibatis" tableName="Tag" >

</table>
<table schema="blog_ibatis" tableName="Author" >

</table>


并使用Mybatis Generator插件利用逆向工程技术生成java类。 但是生成的java类之间没有关联,如下图 公共类博客{ 私人 int id;

enter code here

private String name;
private String url;
// Reference to Author is not present in this class

}

公开课作者{

private int id;
private String name;
private String email;

}

【问题讨论】:

    标签: reverse-engineering mybatis


    【解决方案1】:

    很遗憾,MyBatis 生成器不支持关联。您必须手动放置它们。见IBatis (MyBatis): Handling Joins: Advanced Result Mapping, Association, Collections, N+1 Select Problem

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-22
      相关资源
      最近更新 更多