I was reading Implementing Domain-Driven Design by Vaughn Vernon and in the chapter about aggregates the following structure is shown:
This structure can be mapping easily using Hibernate/NHibernate as the each entity references the aggregate root by reference.
However, he decides to refactor the design to this:
Now all entities reference the root using the ProductId
value object instead.
How can one model this using Hibernate/NHibernate?
The explanation for the diagrams can be found here Effective Aggregate Design by Vaughn Vernon
Map(x => x.ProductId)
orComponent(x => x.ProductId, c => c.Map(...))
would suffice no? – Firo