我建了三个表,student,course和score
student和course是多对多的关系,score和course是多对一的关系。student中我是这样设定的
@ManyToMany()
@JoinTable(name="score",
joinColumns=@JoinColumn(name="student_id"),
inverseJoinColumns=@JoinColumn(name="course_id")
)
public Set<Course> getCourse() {
return course;
} @Id
@GeneratedValue
public int getId() {
return id;
}score中是
@ManyToOne
@JoinColumn(name="course_id")
public Course getCourse() {
return course;
}

@Id
@GeneratedValue
public int getId() {
return id;
}

public int getScore() {
return score;
}

@ManyToOne
@JoinColumn(name="student_id")
public Student getStudent() {
return student;
}但是每当建表的时候都发现score表建不出来,都报这样的提示
  create table score (
        id int not null,
        score int not null,
        course_id int null,
        student_id int identity not null,
        primary key (student_id, course_id)
    )
15:28:03,137 ERROR SchemaExport:386 - Unsuccessful: create table score (id int not null, score int not null, course_id int null, student_id int identity not null, primary key (student_id, course_id))
15:28:03,137 ERROR SchemaExport:387 - 无法在表 'score' 中可为 Null 的列上定义 PRIMARY KEY 约束。请问应该怎么设定annotation才对??