-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move DTOs from the service to the rest layer #21821
Comments
That wont work, whenever you start to deal with lazily initialized JPA entities, because you need to that in a transaction. |
We are using optimized eager loading in the repository layer. |
Nice idea, dto at service level cause issues for complex custom service relying on others: there are many cases where you get the DTO, retransform to entity to get a field that is used by the other service, ... |
In that case should we remove the VO objects on the Rest layer as well as they are just a mirror of DTOs. We created them to avoid leaking transactional layers to cleint side AFAIK |
I agree with @gzsombor It will probably work for all simple generated projects. DTOs support without service has always been a bad idea. It's a really major breaking changes and we should collect more feedbacks before doing this change. cc @jhipster/developers |
Indeed, we have optional DTOs from the repository to service layers, for those who don't like to have their JPA entities crossing all layers (which isn't my case, I love to do this!!). And then the VOs, for "view objects", are from the service to Web layers - they are similar to the view objects we also have in the front end. |
Also I thought we disallowed DTO without service. Atleast thats how I remember it, or maybe its only on the JDL side, i need to check the code to be sure |
We have VO related to login and security only. DTOs mapping happens between service and view layers or output of view layer. If we remove service layer, generated DTOs are actually VO but they are generated at the non existing service layer
DTO implementation filters related entity fields keeping only key and visual field (select label) behaving like a VO. JHipster's DTO motivation is quite confusing to said the least. |
I suppose this needs more discussion so I will remove from v8 tasks. |
Overview of the feature request
JHipster DTOs are the rest api definitions and are probably best fit in the rest layer.
The main benefit is to simplify the templates by moving all dto operations to the controller.
Motivation for or Use Case
Related issues or PR
The text was updated successfully, but these errors were encountered: