java – Do we need two entities with CQRS without a source of events and using JPA?


So I'm trying to implement DDD and CQRS (no event source). I need clarity about the details of the implementation (Spring + JPA).

DDD with multiple small added roots demand @Entity classes with I.D to maintain relationships that have explicit relationships. According to the effective aggregate design by Vaughn Vernon

My question is: if I want to implement a simple CQRS, do I need to duplicate all my JPAs? Entities for both Read Y to write.?

I'm going with this.

  1. Separate read / write controllers
  2. Inject Consultation service Y Command Service in respective
    Drivers to have a clear transfer in the project structure.
  3. InDomain& # 39; folder I keep my Added entities (As well JPA Lazy
    loading
    ) Y Repositories of added root.
  4. In Myself Infrastructure I need to keep almost the same Entities
    (JPA Eager loading?) Or should I just write simple SQL queries?
    using SpringJdbcTemplate
  5. You have my Consultation service inside of me Infrastructure code.
  6. You have my Command Service inside of me Infrastructure code where I will call domain repositories and domain services (as in this example, ddd for example) and call Audit tables (simple events)

(no source of events because we can not admit that technology and we have little time and we are new to DDD and CQRS)

My question about the article 4) and if I write in queries vs alternative set of JPA If the queries about which JPA technologies are famous libraries will help to obtain secondary entities added by root easily? I know there is an exchange, but I need your thoughts a little bit of decision points.