Comments on: Hexagonal Architecture With Quarkus [Tutorial] https://www.happycoders.eu/software-craftsmanship/hexagonal-architecture-quarkus/ Fri, 29 Nov 2024 10:57:43 +0000 hourly 1 By: Sven Woltmann https://www.happycoders.eu/software-craftsmanship/hexagonal-architecture-quarkus/#comment-33785 Wed, 28 Aug 2024 12:26:35 +0000 https://www.happycoders.eu/?p=38297#comment-33785 In reply to Matheus Moreira.

Hello Matheus,

I'm glad to hear that you like the series!

Transaction control in Hexagonal Architecture is such a complex topic that I could write an entire article about it.

There are different approaches:

* You could make the application core transactional and annotate your services with @Transactional (this has the disadvantage that you bring technological aspects into the core).

* You can manage the transactions at the repository level (like I did).

* You can group your entities into aggregates according to Domain-Driven Design and store and load entire aggregates transactionally at the repository level.

* According to Domain-Driven Design, you could put application services on top of the domain services to manage the transactions.

* And more...

The Hexagonal Architecture is not prescriptive in this regard.

I recommend that you experiment with different variants and analyse which is best suited to your application.

Best wishes,
Sven

]]>
By: Matheus Moreira https://www.happycoders.eu/software-craftsmanship/hexagonal-architecture-quarkus/#comment-33610 Wed, 21 Aug 2024 17:26:16 +0000 https://www.happycoders.eu/?p=38297#comment-33610 Hello, Sven! I recently found your series about Hexagonal Architecture and I find it excellent. There is only one aspect that I have a question about, the transaction control. The code shows the @Transactional annotation on the repository methods but that would result in short lived transactions that don't spam more than one database operation. We usually want to create longer "units of work" that maybe save (or operate upon) multiple objects, maybe making use of more than one repository class.

How could the code be changed to accomplish that?

Apart from this question, everything that I've read up to this point is super informative. Thanks for your great work!

]]>