You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduction of Intermediary Entity: Replaced @manytomany with a formal ProductTag entity, refactoring the relationship into @onetomany and @manytoone associations.
Enhanced Entity Stability: Removed the risky @DaTa annotation in favor of @Getter and @NoArgsConstructor(access = AccessLevel.PROTECTED) to ensure encapsulation and identifier integrity.
Explicit ID Generation: Replaced ambiguous @GeneratedValue with GenerationType.IDENTITY for better database predictability.
Optimized Fetching: Updated the NamedEntityGraph with Subgraphs to ensure Product, ProductTag, and Tag can still be fetched in a single optimized query.
Expected Benefits
Extensibility: Allows for adding relationship-specific metadata (e.g., created_at, display_order) to the ProductTag entity without schema overhauls.
Runtime Reliability: Eliminates potential StackOverflowError during serialization and prevents HashSet inconsistency caused by mutable hashCode values in entities.
Query Control: Provides explicit control over the intermediary table, preventing performance degradation (such as the "Hibernate Bag" issue) during bulk data operations.