英文:
If I use spring data rest+ spring data jpa will it guarantee there will be zero code left in service layer and Dao layer to code manually?
问题
我需要知道如果我们使用Spring Data Rest + Spring Data JPA,是否会取代所有在这些层次中需要手动输入的代码?那么在后端我们还需要开发什么呢?我的意思是,它真的那么强大吗?如果我理解错误,请解释其限制。
英文:
I need to know if we use spring data rest + spring data jpa then will it replace all the code that we need to type manually in those layers.? So then what else we have left to develop in the back-end?I mean is it really that awesome? Please explain the limitations if I am wrong.
答案1
得分: 0
你不需要编写DAO。如果您需要超出简单CRUD的自定义查询,有不同的方法可以创建它们,以及不同的存储库接口可供扩展(如PagingAndSorting等)。
然后,在服务层中使用@Autowired将您的存储库自动连接,以应用业务逻辑。
不需要DAO。
英文:
You do not need to write a DAO. If you need custom queries beyond simple CRUD there are different ways to create them as well as different repository interfaces to extend (PagingAndSorting etc).
Then you @Autowire your repository into the service layer to apply business logic.
No DAO necessary.
专注分享java语言的经验与见解,让所有开发者获益!
评论