https://kotlinlang.org logo
#exposed
Title
# exposed
m

Muhammad Talha

08/17/2022, 5:00 AM
Hey all - beginner here: What’s the best way to decouple the DAO API from my app? It looks like the DAO API is both an entity and a DAO so I was wondering what the best way to go about this was. I could just resort to using the DSL API and have my own DAO object and Entity, but was hoping to avoid the boilerplate of mapping table properties to that entity. Thanks!
p

PoisonedYouth

08/17/2022, 5:50 AM
I would add a repository between Exposed DAO and the business services, to not mix business logic with Exposed specific functionality. This layer I use for mapping DAO entity to domain object and also doing transaction handling.
m

Muhammad Talha

08/17/2022, 6:34 AM
I see so you do a bit of mapping from the exposed DAO API to your custom domain object. Do you find that easier than using the DSL API and doing the same mapping?
p

PoisonedYouth

08/17/2022, 6:36 AM
It's not saving too much. Just a few query methods which DAO offers
m

Muhammad Talha

08/17/2022, 7:32 AM
Got it thanks, makes sense!
2 Views