rymghosn opened a new pull request, #6287:
URL: https://github.com/apache/fineract/pull/6287
TaxComponent.taxComponentHistories was mapped as a unidirectional
@OneToMany with a @JoinColumn(nullable = false) and no owning side (mappedBy)
declared on the child entity. This is a problematic pattern for a
foreign-key-based one-to-many: since the parent's collection — not the child —
is left managing the relationship, adding a new TaxComponentHistory row to
an already-persisted TaxComponent risks a flush-ordering issue against
the NOT NULL foreign key column. This is exactly what happens whenever a
tax component's percentage or start date is edited
(TaxComponent.update() adds a new history entry to the collection).
This PR makes the relationship properly bidirectional:
- Adds a @ManyToOne(optional = false) back-reference (taxComponent) on
TaxComponentHistory, owning the foreign key via @JoinColumn.
- Changes TaxComponent.taxComponentHistories to @OneToMany(mappedBy =
"taxComponent", ...).
- Updates TaxComponentHistory.createTaxComponentHistory(...) to accept and
set the parent reference, and updates its single call site in
TaxComponent.update().
No API/behavior changes — this is purely a persistence-mapping correctness
fix, functionally equivalent for read paths but avoids the
flush-ordering hazard on write.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]