on-internet
← Community

Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not execute statement

Stack Overflow ·

What the reason of my mistake? I have to entities. Their relation is many to many. prepod: @Entity(name = "prepod") public class Prepod { private Long id; List<Student> students = new ArrayList<Student>(); @ManyToMany public List<Student> getStudents() { return students; } public void setStudents(List<Student> students) { this.students = students; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") public Long getId() { return id; } public void setId(Long i) { id = i; } } student: @Entity @Table(name="Student") public class Student { private Long id; private String n

Comments

Sign in or sign up to comment and upvote.

No comments yet.