实体类 很简单
多对多 Student =====>Teacher 多对多会生成第三方表t_s
public class Student {
private int id;
private String name;
private Set
public class Teacher {
private int id;
private String name;
private Set
有什么疑问找我==============希望能帮到你
这样配置是完全正确的,但是懒加载必须在session关闭前显示调用xxx.getxxxlist();
fetch = fetchtype.lazy是说在你得到xxx的时候是否顺便把xxxlist加载到缓存中
并不代表你在session关闭后还存在!
当不需要懒加载时候 fetch = fetchtype.eger可以提高执行效率
另外在many端是不用fetch = fetchtype.lazy 默认就是这种配置
这是hibernate文档的demo。。。
第一个class标签,定义了多个person,对应一个address(unique=true);
第二个class标签,定义了一个person,对应了一个address。