I have the following situation in my spring boot application:
I use unidirectional relationship modelling for my database entities, in order to prevent difficulties with a bidirectional approach. (Cascading, Updating both sides etc.) Of course I don't want to expose this structure to the presentation layer, thus my DTOs are compositions over multiple tables. Now I have the following question: How do I properly aggregate this DTOs?
At the moment I have a datacomposition service, which calls the relevant services and builds the DTOs. This service is transactional, because otherwise I could create something in one service, but won't be able to roll it back if something goes wrong in antother one. This is cleanest approach I came up with. Before my controller did this work, but this was a bad idea because of the transaction handling. My Problem with this approach is that this datacomposition service returns DTOs, which I don't like since I belong to the group saying, that the service layer only deals with domain objects. Is this acceptable?
Thank you for your help!