hoymkot
hoymkot

Reputation: 458

Is there any good generic JPA DAO implemenation?

According this article, generic JPA DAO(Data Access Object) is a pretty nice pattern.

Is there any good implementation?

Upvotes: 5

Views: 17293

Answers (3)

lujop
lujop

Reputation: 13883

Querydsl supports JPA and has an extensive support for building complex predicates for queries.

It doesn't support updates and inserts but you can use Spring Data for that, as Querydsl also integrates with Spring repositories.

Upvotes: 0

Biju Kunjummen
Biju Kunjummen

Reputation: 49925

Just wanted to mention a couple more generic dao implementations for JPA:

Upvotes: 2

Francisco Spaeth
Francisco Spaeth

Reputation: 23903

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 like select Entity from Entity where id = 'given string'

Methods like findByNameAndLastName(String name, String lastName) or even findByNameOrInternalId(String name, int internalId) are supported too.

Upvotes: 6

Related Questions