ADF-BC EO 介紹ppt課件_第1頁
ADF-BC EO 介紹ppt課件_第2頁
ADF-BC EO 介紹ppt課件_第3頁
ADF-BC EO 介紹ppt課件_第4頁
ADF-BC EO 介紹ppt課件_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、ADF-BC EO 介紹介紹資深技術(shù)顧問甲骨文 開發(fā)者計劃ADF-BC Entities ObjectCharacteristics of Entity ObjectsEntity objects: Represent a row in a database table or other data source Handle database caching Contain attributes representing the database columns Encapsulate attribute-level and entity-level validation logic Can

2、contain custom business methodsUsing Entity Objects to Persist DataCustomersEOIdNameStatusEmailEntity objectAttributesDatabase tableStatus List(Gold Silver Platinum)Validation ruleID201NAMESteveSTATUSGoldEmail202MikeSilverCUSTOMERSCreating Entity Objects from Tables, Views, or SynonymsWhen you creat

3、e an entity object, JDeveloper: Interrogates the data dictionary for information about attribute Names, types, relationships based on primary/foreign key relationships, Infers primary key, or creates one from RowID Creates implicit validators for database constraints Creates the XML component defini

4、tion file (.xml) Creates optional Java files if selected, such as entity object class Impl.java Generates associations based on foreign keys, if applicable (FkAS.xml) these should be renamedModifying the Default Behavior of Entity Objects With declarative settings, you can: Define attribute control

5、hints Use alternate key entity constraints Refactor (rename or move) objects Create and publish events Validate user input (presented in a later lesson) Many other modifications are possible with coding, such as: Overriding base class methods Implementing calculation and recalculation of transient a

6、ttributesDefining Attribute Control Hints12Associations Define a relationship between EOs Facilitate access to data in related entity objects May be based on database constraints May be independent of database constraints Are used in defining validations and LOV metadata Consist of a source (master)

7、 and a destination (detail) entitySourceDestinationOrdersPersonsFkASAssociationPersonsEOOrdersEOCreating Associations Automatically created when creating 2nd EO with foreign keyCreating Associations Using the Create Association wizardAssociation Types Association Entities are related but not complet

8、ely dependent Either end of the association can exist without the other Either can be deleted without deleting the other Composition Destination entity is completely dependent on the source entity The source entity owns the destination entity No destination entity can be created without the owning e

9、ntity existing first The source entity cannot be deleted without deleting all its associated destination entitiesUsing Alternate Key Entity ConstraintsAlternate keys are: Used for efficient uniqueness checks Used for direct row lookups with findByKey() methods Different from primary keys or unique k

10、eysRefactoring ObjectsWith refactoring you can: Rename objects, such as associations and view links Move objects or packages to a different package Change all references throughout the applicationWorking Programatically with Entities and AssociationsFinding an Entity Object by Primary KeypublicStrin

11、gfindOrderID(longorderId)StringentityName=oracle.apps.str.model.entity.OrderEO;EntityDefImplorderDef=EntityDefImpl.findDefObject(entityName);KeyorderKey=newKey(newObjectorderId);EntityImplorder=orderDef.findByPrimaryKey(getDBTransaction(),orderKey);if(order!=null)return(String)order.getAttribute(“Sh

12、ipToName);elsereturnnull;1234public String getLocationId() return getDepartmentEO().getLocationId(); Traversing Associations:Source to Destination The destination entitys EntityImpl.java methods to get and set the source entity. For example, EmployeeEOImpl.java contains getDepartmentEO() and setDepa

13、rtmentEO(). You could add a method to EmployeeEO.java to get the Location ID of the department to which the employee belongs:getEmployeeEO()DepartmentEODepartmentEOToEmployeeEOEmployeeEOgetDepartmentEO()getLocationId()Updating or Removingan Existing Entity Rowpublic void updateEmpEmail(long empId, S

14、tring newEmail) EntityImpl emp = retrieveEmployeeById(empId); if (emp != null) emp.setAttribute(“Email,newEmail); try getDBTransaction().commit(); catch (JboException ex) getDBTransaction().rollback(); throw ex; 123Creating a New Entity Rowpublic long createProduct(String name, String description) S

15、tring entityName = “oracle.apps.str.model.entity.ProductEO; EntityDefImpl productDef = EntityDefImpl.findDefObject(entityName); EntityImpl newProduct = productDef.createInstance2(getDBTransaction(),null); newProduct.setAttribute(Name,name); newProduct.setAttribute(Description,description); try getDB

16、Transaction().commit(); catch (JboException ex) throw ex; DBSequence newIdAssigned = (DBSequence)newProduct.getAttribute(ProdId); return newIdAssigned.getSequenceNumber().longValue(); 12345Coding: The Supporting Java Classes EntityImpl The entity class Represents a row Provides getter and setter met

17、hods EntityDefImpl The entity definition class Represents the whole entity Can be used to modify the entity definition EntityCollImpl Represents the cached set of rows from the entity It is not necessary to modify or override methods in this classOverriding Base Class MethodsYou can override methods in the base classes for objects. For example, you can override methods in EntityImpl.java, such as: doDML() Use to log changes in another entity beforeCommit() Use to validate multiple instances of the same entity remove() Use to log a deletion in an entityOverri

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論