zoukankan      html  css  js  c++  java
  • SAP Hybris和ABAP Netweaver里的DAO(Data access object)

    DAO在Hybris里的定义:

    A DAO (Data Access Object) is an interface to the storage back end system. DAOs store and retrieve objects. You use DAOs to save, remove, and find models. DAOs are the place to put SQL or FlexibleSearch statements and nowhere else. This is to ensure further decoupling from the underlying storage facility. DAOs interact with services via models and with the database via FlexibleSearch and SQL statements.
    确实这是一个common的concept, 就是对持久层的CRUD进行封装,以实现上一层对持久层具体实现的解耦。

    随便抽一个ABAP的DAO实现:

    Hybris里所有DAO实现的super class是hybris标准的框架DAO, 定义在如下namespace里. 讨论都是一个DAO作为interface定义操作,

    另一个default开头的DAO提供default实现: 拼SQL然后call flexibile search.

    这里的flexible search就相当于ABAP的OPEN SQL, 把DB的access同具体的DB provider解耦。
    runtime时具体用哪个DAO的实现,是在Spring的配置文件里注入的:

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    多线程下单例模式:懒加载(延迟加载)和即时加载
    Java 线程同步
    java 多线程之wait(),notify,notifyAll(),yield()
    序列化和反序列化及线程实现方式
    错题解析
    错题解析
    考试:错题总结
    测试:错题总结
    hashCode与equals的区别与联系
    @Not
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/12418506.html
Copyright © 2011-2022 走看看