inverse和mappedBy是同一个东西,只是inverse是用于xml配置,而mappedBy则是用于注解中。
a) 只有OneToOne,OneToMany,ManyToMany上才有mappedBy属性,ManyToOne不存在该属性;
b) mappedBy标签一定是定义在the owned side(被拥有方的),他指向the owning side(拥有方);
c) mappedBy的含义,应该理解为,拥有方能够自动维护跟被拥有方的关系;
当然,如果从被拥有方,通过手工强行来维护拥有方的关系也是可以做到的。
style="VISIBILITY: hidden" height="60" src="http://darrenzhu.iteye.com/iframe_ggbd/794" frameborder="0" width="468" scrolling="no">
a) 只有OneToOne,OneToMany,ManyToMany上才有mappedBy属性,ManyToOne不存在该属性;
b) mappedBy标签一定是定义在the owned side(被拥有方的),他指向the owning side(拥有方);
c) mappedBy的含义,应该理解为,拥有方能够自动维护跟被拥有方的关系;
当然,如果从被拥有方,通过手工强行来维护拥有方的关系也是可以做到的。