Reputation: 425
I am using Hexagonal Architecture, Hibernate Reactive with Panache and Quarkus in a Kotlin Project.
Transaction boundaries are set using @ReactiveTransactional
annotation.
The problem is that I had to add the whole Hibernate Reactive with Panache
dependency in the domain and application layers just to make this annotation available.
Is there a way to avoid this?
I was hoping it would be possible to create a domain annotation and then in the adapters layer replace it with the @ReactiveTransactional
somehow.
Upvotes: 0
Views: 1082
Reputation: 21
Don't use database related dependencies inside the hexagon.
The idea is to decouple the business logic from the user interface and infrastructure. Database logic should be placed into an adapter.
It theory it sounds great, in practice that means tons of mappers i.e. boilerplate code. On the bright side you have a Kotlin, and not a Java project so this should be a bit less tedious than the alternative. Bear in mind that there are projects such as Dozer, MapStruct that can make the mapping process easier.
Upvotes: 0
Reputation: 4754
You could remove the annotation from the class, and wrap it into a service, and implement this service in the adapter layer using the annotation.
Upvotes: 0