@SuppressWarnings("JpaDataSourceORMInspection") @Data @Entity public class Student { @Id private Long id; private Integer anotherId; @ToString.Exclude @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinTable(name = "student_course", joinColumns = @JoinColumn(name = "another_id", referencedColumnName = "anotherId"), inverseJoinColumns = @JoinColumn(name = "course_id")) private Set<Course> courses = new HashSet<>(); } @Data @Entity public class Course { @Id private Long id; @ToString.Exclude @ManyToMany(mappedBy = "courses", fetch = FetchType.LAZY) @JsonIgnoreProperties("courses") private Set<Student> students=new HashSet<>(); }
Here is what I want: I want my another_id column, which will be created when the junction table is created, to match the anotherId variable in my Student entity, but instead it only matches the id variable. Can you tell me something about how to solve the problem I am experiencing?
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)