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的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    使用ansible 批量分发ssh密钥
    修改DNS
    如何使用openssl生成RSA公钥和私钥对
    压力测试 php-fpm 优化
    mysql 安装
    svn 权限配置
    powerdesigner导出word
    Mysql无法创建外键的原因
    office project 激活
    MySQL日志恢复误删记录
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/12418506.html
Copyright © 2011-2022 走看看