How to persist child entity in oneToMany relationship ?
@Entity
public class Payment implements Serializable {
@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
@JoinColumn(name = "registration", nullable = false)
private Registration registration;
}
@Entity
public class Registration implements Serializable {
@OneToMany(mappedBy="registration", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
private List<Payment> payment;
}
On registration creation, if registration column is not nullable in Payment table :
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'registration' cannot be null
But if registration is nullable then a payment is created but registration column is null :
Until an exception occurs and "HH000010: On release of batch it still contained JDBC statements" be executed.
Please can you help me, to disabled Hibernate batch or understand what is wrong ?