I read several articles about diff between DAO and Repository patterns. From what I understood repository should not have query smth like this

List query(AccountSpecification specification);

and DAO has

List getAccountByLastName(String lastName);
List getAccountByAgeRange(int minAge, int maxAge);
void updateEmailAddress(String userName, String newEmailAddress);
void updateFullName(String userName, String firstName, String lastName);

and When I am extending spring data jpa repository

interface AccountRepository extends AccountRepository<Account>{
    List getAccountByLastName(String lastName); 

Does AccountRepository satisfies to repository pattern? or it is already DAO

  • In my humle opinion. Spring doesn't satisfies the pattern as It was originally conceive in DDD. Spring's implementation treat repositories as DAOs. Note that repositorios get datasource injected. And these are tightly bound to DB entites not to domain entities. – Laiv Feb 9 '18 at 5:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.