vendredi 27 juillet 2018

DDD Entity in orm and java

I started reading chapter 5 of E. Evans DDD and try to make head or tail of the concepts.

In context of ddd what is and what is not entity and what is value object ?

looking at Value object or entity object in my Hibernate mapping? - but it is about Hibernate, not DDD, I ask about DDD

  1. In above sample of hibernate OrderLine is Entity, but is OrderLine still a DDD entity ?
  2. And more generally, can we say that any jpa/Hibernate @Entity is DDD entity, or not ?
  3. It seems to me, that OrderLine is a good example of Jpa/Hibernate entity that is not a DDD entity, is it ?

If we for instance had used some object database we would possibly store Order togeter with it's OrderLines, wouldn't we ?

  1. In terms of relational databases could we say, that Jpa @Entity that is mapped in database as OnDeleteCascade is not a DDD Entity, but it is still a value object ?
  2. Is hibernate @Embedded always a DDD value object ? (seems yes, it has no identity)

Ok, and now other case with other doubts. Lets say that we have two different systems one in Java other in Python. One for billing other for marketing. Both of them have a Customer Entity.

  1. Do we say that BillingCustomer is the same DDD Entity as MarketingCustomer (assuming both of them represent the same Customer John Doe born 01.01.1980 wiht ssn 12-34-56)? This would imply that in java two different classes, even not having common parent (except from Object) can represent the same DDD entity. If so, how should equals be implemented in above classes ?
  2. Should java equals return true for two different java classes representing the same DDD entity ?

Aucun commentaire:

Enregistrer un commentaire