Why put a DAO layer over a persistence layer (like JDO or Hibernate)

前端 未结 10 830
梦谈多话
梦谈多话 2021-01-31 09:13

Data Access Objects (DAOs) are a common design pattern, and recommended by Sun. But the earliest examples of Java DAOs interacted directly with relational databases -- they were

10条回答
  •  面向向阳花
    2021-01-31 09:40

    It depends what your layer's goals are. You put an abstraction in to supply a different set of semantics over another set. Generally further layers are there to simplify somethings such as development of future maintennance. But they could have other uses.

    For example a DAO (or persistence handling) layer over an ORM code supply specialised recovery and error handling functionality that you didn't want polluting the business logic.

提交回复
热议问题