Hello,

I have another weird scenario going on here with persisting a
LoanTransaction. In brief what happens is this;

 - LoanTransaction has a OneToMany relationship with
LoanTransactionToRepaymentScheduleMapping
 - LoanTransactionToRepaymentScheduleMapping has in turn a ManyToOne
relationship with LoanRepaymentScheduleInstallment.
 - When I hit LoanTransaction.save(loanTransaction),
the LoanRepaymentScheduleInstallment get persisted, but the generated id of
the persisted instance is not assigned to the corresponding column
in LoanTransactionToRepaymentScheduleMapping so I repeatedly have this
error:
"java.sql.SQLIntegrityConstraintViolationException: Column
'loan_repayment_schedule_id' cannot be null" which I believe means the id
of LoanRepaymentScheduleInstallment is not added
to LoanTransactionToRepaymentScheduleMapping hence tests fails.

This same error also applies to every other test that deals with writing
LoanTransactions(there are about 16 of them).

I've tried a couple of things;
 - Used: CascadeType.ALL, CascadeType.PERSIST, FetchType.LAZY.
 - Also tried breaking down the transaction from a save to small for loops
where I saved and assigned the ids manually and weirdly that didn't work
either.

A bit of assistance with this will be very welcome. Perhaps there is
something I'm not seeing.

Thanks.

Reply via email to