AmsterdamLuis
AmsterdamLuis

Reputation: 425

Hexagonal Architecture with Hibernate Reactive and Quarkus

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

Answers (2)

Marko Haberl
Marko Haberl

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

choquero70
choquero70

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

Related Questions