Repeat After Me: Repositories Aren’t DAOs

More and more I’ve seem the Repository been used as a fancy name for DAOs. It is very common nowadays to have things named Repository that create SQL/HQL/EJBQL queries or deal with database transactions or connections. Only a DAO with a different name.

I thought about posting something about the differences between DAOs and repositories again but I really can’t add anything to the previous post at this time.

4 Responses to “Repeat After Me: Repositories Aren’t DAOs”


  1. 1 Daniel Aragao Apr 30th, 2008 at 12:18 am

    The industry seems to be leaning towards accepting this misuse as a default.
    e.g. this is Spring’s 2.5 @Repository annotation doco:
    “public @interface RepositoryIndicates that an annotated class is a “Repository” (or “DAO”).”
    Cheers.

  2. 2 Rafael Ponte May 6th, 2008 at 12:18 am

    Between all patterns from the DDD the Repository is what brings more confusion for developers, maybe because they think always in DAOs when if speak about persistence!

  3. 3 Sławek S. Oct 30th, 2008 at 8:03 am

    You write about “business concept” of Repository in previous post…

    Could You explain it to me as if I were and idiot what is the difference between:
    - classic DAO but just called Repository (ex OrdersRepository instead of OrdersDAO)
    - your real Repository

    I think that code example would be sufficient - interface and impl for both cases. If You could also add some kind of philosophyical explanation to examples than everything should be clear. But I think that only example can clarify this issue.

  1. 1 Domain-Driven Bolovo, Passando Conhecimento e etc. « Fragmental Pingback on Jan 18th, 2010 at 9:35 pm

Leave a Reply








Creative Commons License

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.