Skip to content

MS-238/Fix: Add @ToString annotations and exclude relationships to prevent infinite loops in Order package

salaheddine zidani a demandé de fusionner feature/MS-238 vers develop

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 @ToString and excluded order field
  • RefundOrderLine.java: Added @ToString and excluded refundOrder field
  • EditHistory.java: Excluded order field from toString
  • Note.java: Excluded order field from toString
  • OrderLine.java: Excluded order field from toString
  • OrderStatusHistory.java: Excluded order field 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
Modification effectuée par salaheddine zidani

Rapports de requête de fusion