According this article, generic JPA DAO(Data Access Object) is a pretty nice pattern.
Is there any good implementation?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could take a look into the Spring Data JPA.
A few new concepts were introduced into Spring Data JPA, for instance the Query creation based on the method name, so you can declare a method like
findById(String id)and the “generic” implementation will interpret the method’s name and execute something likeselect Entity from Entity where id = 'given string'Methods like
findByNameAndLastName(String name, String lastName)or evenfindByNameOrInternalId(String name, int internalId)are supported too.