I found JPA, or alike, don’t encourage DAO pattern

For simple applications, I don’t see any problem in using the EntityManager directly from EJBs and skipping the DAO pattern (I’m tired of writing too much code). And my feeling is indeed that this is what JPA and the Java EE API encourage. But it may still be justified for more complex applications (for data access from stored procedure, flat files…). So you are right, it depends 🙂

You’ll find some other enlightened point of views in Has JPA Killed the DAO? on InfoQ but you won’t be surprised by the content and the conclusion that can be summarized as: you don’t really need the DAO pattern anymore for standard data access, you may however need it for some more complex situations, but we live better without it.

Leave a Comment