MS-238/Fix: Add @ToString annotations and exclude relationships to prevent infinite loops in Order package
Summary
Added @ToString annotation to RefundOrder and RefundOrderLine entities, and added @ToString.Exclude on bidirectional relationship fields across Order package entities (except Order) to prevent StackOverflowError caused by circular references.
Changes
-
RefundOrder.java: Added@ToStringand excludedorderfield -
RefundOrderLine.java: Added@ToStringand excludedrefundOrderfield -
EditHistory.java: Excludedorderfield from toString -
Note.java: Excludedorderfield from toString -
OrderLine.java: Excludedorderfield from toString -
OrderStatusHistory.java: Excludedorderfield from toString
Why
In bidirectional JPA relationships, Lombok-generated toString() methods cause infinite recursion (e.g., Order → OrderLine → Order → ...), resulting in a StackOverflowError. The @ToString.Exclude annotation breaks this cycle.
Testing
- Verified that toString() can be called on all affected entities without causing infinite loops Closes MS-238