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的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的SAP Hybris和ABAP Netweaver里的DAO(Data access object)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SAP CRM WebClient UI
- 下一篇: 神都夜行录变身哪个强