




版權(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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度按揭購車信用保險合作協(xié)議范本
- 物流行業(yè)智能調(diào)度與配送優(yōu)化方案
- 品牌推廣策略實施指南
- 生態(tài)旅游開發(fā)居間合同
- 中醫(yī)護理學(第5版)課件 第4章 病因
- 三農(nóng)村社區(qū)建設(shè)方案推廣手冊
- 項目可行性研究包括
- 污水處理廠建設(shè)項目
- 三農(nóng)地區(qū)農(nóng)產(chǎn)品物流配送方案
- 辦公區(qū)月度活動策劃方案
- 2025年合肥幼兒師范高等??茖W校單招職業(yè)適應性測試題庫新版
- 2025年浙江寧波交投公路營運管理限公司招聘12人高頻重點模擬試卷提升(共500題附帶答案詳解)
- 勞務(wù)派遣勞務(wù)外包項目方案投標文件(技術(shù)方案)
- 第四單元 第三課 拍攝學校創(chuàng)意短視頻教學設(shè)計 2024-2025學年西交大版(2024)初中信息技術(shù)七年級上冊
- 2025年蘇州工業(yè)職業(yè)技術(shù)學院高職單招職業(yè)技能測試近5年??及鎱⒖碱}庫含答案解析
- 2024年尖葉菠菜種子項目可行性研究報告
- DB3306T 074-2025 餐用具消毒房管理規(guī)范
- 2025年重慶市初中學業(yè)水平暨高中招生考試數(shù)學試題預測卷(二)
- “記憶中的人、事兒”為副標題(四川眉山原題+解題+范文+副標題作文“追求”主題)-2025年中考語文一輪復習之寫作
- 醫(yī)療器械進院流程
- 2024年吉安職業(yè)技術(shù)學院單招職業(yè)技能測試題庫附答案
評論
0/150
提交評論