Single DAO & generic CRUD methods (JPA/Hibernate + Spring)

前端 未结 5 452
你的背包
你的背包 2020-11-28 18:26

Following my previous question, DAO and Service layers (JPA/Hibernate + Spring), I decided to use just a single DAO for my data layer (at least at the beginning) in an appli

5条回答
  •  [愿得一人]
    2020-11-28 18:49

    I was looking for this same thing. I found what appears to be exactly that- the Spring-Data JPA project provided by SpringSource. This is a code port from Hades and has now (Early 2011) been swallowed by Spring and better integrated. It allows you to use a single dao (SimpleJpaRepository) with a static create, or extend the base JpaRepository class to create any object specific dao with ready made CRUD+ methods. Also allows grails like queries just by using params names as the name of the method- in the interface (no implementation required!) i.e. findByLastname(String lastName); Looks very promising- being part of Spring projects will certainly ensure some future for it too. I have begun implementing this in my upcoming project now.

提交回复
热议问题