3

JHipster is great. It, however, models all objects as domain entity objects. An enum class, for example, is treated as a domain class. If I want to practice the domain driven design, I need to convert some of entity classes, which are generated by JHipster, to value classes along with other types of changes such as replacing primitive types with domain object data types. Can I still run import-jdl after making such changes? In the other words, whether the changes are maintiable with a JDL?

BTW, there is a good talk on DDD by Edson Yanaga posted on youtube.

Dave
  • 5,108
  • 16
  • 30
  • 40
vic
  • 2,548
  • 9
  • 44
  • 74

2 Answers2

0

An interesting talk about DDD:

Implementing DDD with the Spring Ecosystem by Michael Plöd @ Spring I/O 2018

There's a concept coming from the video, that I've found very important:

JPA entities are not domain entities.

JPA entities and repositories are what you use to persist data on the Db. While the Domain is what you use inside the application.

To answer, I think that you can build your domain classes separately, without caring too much about JPA entities. I suppose that's better to have a consolidated JPA layer before to start building the Domain side, if the two are somehow linked (and usually they are)

Please consider that I've just started to study this topic. Would be good to hear other opinions.

funder7
  • 1,622
  • 17
  • 30
  • This is an old answer, but it's very, very mistaken. Repositories (the interface) belongs to the domain and receives and returns domain objects. The implementation is an Adapter and they are outside of the domain. The idea behind JPA is to map the domain to the DB. There is no gain otherwise from using an ORM which implements JPA, as the complexity they add is considerably high. Some apps will benefit from using JPA on the domain aggregates/entities/VOs. Some others won't and might be better to use plain SQL or a mapping library such as myBatis or JOOQ. – Augusto Nov 20 '22 at 15:59
0

It's a pity that, in short, JHipster just does not support Value Objects, which makes it incomplete to design a DDD application by only caring about models.

See issue1,issue2,another SO question

Xin Liang
  • 21
  • 3