俩个实体分属俩个子系统(实体,双向M:N,有关俩个实体的联系代码如下)
Student类中:
private Collection<Course> courses= new ArrayList<Course>();
@ManyToMany
@JoinTable(name="SC")
public Collection<ClassInfo> getClasses() {
return classes;
}
public void setClasses(Collection<ClassInfo> classes) {
this.classes = classes;
}
Course类中:
private Collection<Student> students = new ArrayList<Student>();
@ManyToMany(mappedBy="courses")
public Collection<Student> getStudents() {
return students;
}
public void setStudents(Collection<Student> students) {
this.students = students;
}
分别把俩个系统的实体打了JAR包到另外个子系统
这样都部署不上去啊(没加这个双向M:N的联系时,可以部署,或者把俩个实体放在一个系统里也可以)
俩个实体在不同系统中,(@ManyToMany @JoinTable mappedBy什么的)还是按原来的那样部署么
还是不一样的部署还有我疑惑的是:
mappedBy="courses" 这里courses在另外个子系统,有办法反向映射么?
还有@JoinTable(name="SC"),这里的SC表能连接俩个不同系统中的表么?那SC表的外键该怎么指向?表不在一起啊,SC要么跟Student表一起要么跟Course表一起啊搞了一晚上
搞不出来或者根本就不能这么做
谁知道我再给他加分啊
也许我描述的不够清楚
可以给我留言
[email protected]
Student类中:
private Collection<Course> courses= new ArrayList<Course>();
@ManyToMany
@JoinTable(name="SC")
public Collection<ClassInfo> getClasses() {
return classes;
}
public void setClasses(Collection<ClassInfo> classes) {
this.classes = classes;
}
Course类中:
private Collection<Student> students = new ArrayList<Student>();
@ManyToMany(mappedBy="courses")
public Collection<Student> getStudents() {
return students;
}
public void setStudents(Collection<Student> students) {
this.students = students;
}
分别把俩个系统的实体打了JAR包到另外个子系统
这样都部署不上去啊(没加这个双向M:N的联系时,可以部署,或者把俩个实体放在一个系统里也可以)
俩个实体在不同系统中,(@ManyToMany @JoinTable mappedBy什么的)还是按原来的那样部署么
还是不一样的部署还有我疑惑的是:
mappedBy="courses" 这里courses在另外个子系统,有办法反向映射么?
还有@JoinTable(name="SC"),这里的SC表能连接俩个不同系统中的表么?那SC表的外键该怎么指向?表不在一起啊,SC要么跟Student表一起要么跟Course表一起啊搞了一晚上
搞不出来或者根本就不能这么做
谁知道我再给他加分啊
也许我描述的不够清楚
可以给我留言
[email protected]
跨系统反向映射好像不行吧!
楼主为什么不拿数据库座位衔接两个系统的桥梁,而ORM映射的话,两个系统都配置全部的实体,毕竟O/R映射应该是针对你这个系统能访问到的数据库表,而不是针对应用来做
楼主为什么不拿数据库座位衔接两个系统的桥梁,而ORM映射的话,两个系统都配置全部的实体,毕竟O/R映射应该是针对你这个系统能访问到的数据库表,而不是针对应用来做