I am building a monolith project using Axon framework. I have a method here that dispatches an event And this is my event handler that might throw an exception My question is, how should I handle the exception? I thought of two things: Should I dispatch an event from the event handler to reverse the transaction? How do I make
Tag: domain-driven-design
DDD: choose relationship or only id reference with JPA/Hibernate
Here is a situation makes me quite confusing. I have two tables: users and articles. One user can write multiple articles and one article can only have one author. From this business. I have two entity: If I follow the JPA style, the Article should be like this: This will make the query service quite easy. For example, I may
What nested class type is best suitable for Domain Events?
I am following Domain Driven Design and Clean/ Hexagonal architecture in my Java microservice. I have domain events declared in my aggregate root class as non-static nested classes. My question is whether these classes should be static nested classes or non-static nested classes(inner classes)? I used non-static nested classes but IntelliJ IDEA suggests to make them static. According to the
How to use Mapstruct with Ad Hoc Setters
I am trying to apply MapStruct to DDD. I created my entities with ad hoc setters like this: and I have a EmployeeDto to send data to frontend API: so, I am trying to use MapStruct to map, but it is not working because my ad hoc setter. How could I resolve this problem? Answer You have to implement custom