wash

          ofbiz entity engine guide

          The primary goal of the entity engine is to eliminate the need for entity specific persistence code in as many areas of a transactional application as possible. Granted that this sort of abstraction is a different issue for reporting and similar systems, but for transactional systems such as are used on a day to day basis in all businesses, an entity engine can save a great deal of development effort and dramatically reduce persistence related bugs in the system. These types of applications include everything from ecommerce to accounting to inventory and warehouse management to human resources and so on. These tools can be useful for reporting and analytical systems,

          but really aren't meant to allow for the wide variety of custom queries that often take place in such tools.???


          In order to achieve having as little entity specific code as possible, all value objects are generic, using a map to store the fields values of the entity instance by name. The get and set methods for the fields take a String with the fieldName in it which is used to verify that the field is part of the entity, and then either get or set a value as desired.
           
          The danger of this flexibility is curtailed using a contract between the entity engine and the application; this is contained in a special XML file.???


          Instead of writing entity specific code, entity definitions are read from an XML file and used by the entity engine to enforce a set of rules between the application and the data source, be it a database or some other source. These XML entity definitions specify the names of all of the entities and their fields along with which database tables and columns they correspond to. They are also used to specify a type for each field which is then looked up in the field types file for the given data source to find the Java and SQL data types. Relations between entities are also defined in this XML file. A relation is defined by specifying the related table, the type of relation (one or many) and the keymaps for the relation. A title can also be given to the relation which becomes part of its name to distinguish it from other relations to that specific related entity. 

          Using the Entity Engine as an abstraction layer, entity specific code can be easily created and modified. Code that uses the Entity Engine APIs to interact with entities can be deployed in various ways so that entity persistence can be done differently without changing the code that interacts with those entities on a higher level. An example of the usefulness of this abstraction is that, by changing a configuration file, an application written using the Entity Engine can switch from hitting a database directly through JDBC to using an EJB server and Entity Beans for persistence. The same code could also be used for custom data sources like legacy systems over HTTP or messaging services through a bit of custom coding within the same framework.


          posted on 2006-01-24 14:48 wash 閱讀(277) 評論(0)  編輯  收藏 所屬分類: java


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 武平县| 阿鲁科尔沁旗| 白河县| 棋牌| 萝北县| 江油市| 元朗区| 乐山市| 贵州省| 浠水县| 赤水市| 富宁县| 正阳县| 南乐县| 柳林县| 新巴尔虎右旗| 海阳市| 固阳县| 奎屯市| 灵武市| 广水市| 平乡县| 湄潭县| 肥东县| 礼泉县| 讷河市| 全州县| 车险| 于都县| 香格里拉县| 广元市| 利津县| 白朗县| 北安市| 慈利县| 云梦县| 贵定县| 泸定县| 江油市| 商城县| 嘉禾县|