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


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 东山县| 时尚| 鱼台县| 鹤峰县| 平塘县| 东乡县| 浙江省| 江津市| 顺义区| 高淳县| 济宁市| 当涂县| 佳木斯市| 华阴市| 丹阳市| 本溪| 马关县| 贵港市| 揭西县| 徐州市| 陇西县| 大荔县| 宿迁市| 泽普县| 曲沃县| 河源市| 高碑店市| 岚皋县| 东光县| 东方市| 特克斯县| 钦州市| 上思县| 浮山县| 曲阜市| 犍为县| 镇原县| 阿瓦提县| 秦皇岛市| 梅河口市| 阿尔山市|