Hibernate not recognizing changes to an embedded object in a parent entity, causing unexpected persistence behavior
After trying multiple solutions online, I still can't figure this out... Hey everyone, I'm running into an issue that's driving me crazy... I'm working with an scenario where Hibernate is not detecting changes to an embedded object within my parent entity, leading to unexpected behavior upon persisting the parent entity. I have an `Order` entity which contains an embedded `ShippingDetails` object. Despite modifying fields in `ShippingDetails`, the changes are not being persisted to the database. Here is a simplified version of my entities: ```java @Entity public class Order { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Embedded private ShippingDetails shippingDetails; // getters and setters } @Embeddable public class ShippingDetails { private String address; private String city; // getters and setters } ``` In my service layer, I'm updating the `Order` like this: ```java @Transactional public void updateOrder(Long orderId, String newAddress, String newCity) { Order order = orderRepository.findById(orderId).orElseThrow(EntityNotFoundException::new); order.getShippingDetails().setAddress(newAddress); order.getShippingDetails().setCity(newCity); // No explicit save call } ``` The question is that when I check the database after calling `updateOrder`, the `ShippingDetails` fields remain unchanged. I have ensured that the transaction is wrapping the operation and that the entity is indeed managed by the session. I've tried adding `@Access(AccessType.FIELD)` to the `ShippingDetails` class and even called `session.flush()`, but it still doesn't continue the changes. I've also checked the logs and I don't see any exceptions or warningsโjust the normal SQL statements being executed for other entities. Am I missing something in my setup, or is there a specific pattern I should follow when working with embedded objects in Hibernate? My Hibernate version is 5.4.27.Final and Iโm using Spring Data JPA. How would you solve this?