Should JPA entities and DDD entities be the same classes?
问题 There are classes that are entities according to DDD, and there are classes that have @javax.persistence.Entity annotation. Should they be the same classes? Or should JPA entities act just as a mechanism for a mapper (https://martinfowler.com/eaaCatalog/dataMapper.html) to load DDD entities from a database (and store them) and be kept outside the domain model? Would it make a difference if database metadata were separated and stored externally (for example, in XML)? If such classes are