Blog表由与Author表的一对一关联组成,我的java类应该像预期的那样。
公共类博客{
private int id;
private String name;
private String url;
private Author author;//getter和setters }
公共类作者{
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插件,利用逆向工程技术生成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;}
发布于 2013-09-30 17:00:06
不幸的是,MyBatis生成器不支持关联。你必须手动放置它们。请参阅http://java.dzone.com/articles/ibatis-mybatis-handling-joins
https://stackoverflow.com/questions/19088935
复制相似问题