hibernate多对多中间表的保存问题
1. 表的设计
a. 角色表
b. 权限表
c. 角色_权限表
2.代码
RoleAuthority roleAuthority = new RoleAuthority(); roleAuthority.getAuthority().setAuthorityId(authorityId); roleAuthority.getRole().setRoleId(roleId); this.saveOrUpdateEntity(roleAuthority);
/** default constructor */public YbRoleAuthority() {this.ybRole = new YbRole();this.ybAuthority = new YbAuthority();}