I have a problem with a OneToMany/ManyToOne relationship:
Class Project:
@OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,
orphanRemoval=true )
@JoinColumn(name="PROJECT_ID", nullable=true)
private Set<Person> personlist = new HashSet<Person>();
Class Person:
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "PROJECT_ID")
private Project project;
Everything works fine as long as there is at least one person connected to a project in the database. If I create a new project and there is no person in the database I get an hibernate exception:
org.hibernate.AssertionFailure: null identifier
I already set nullable=true for the project class but this doesnt work. Ideas anyone?