ADFBCEO介绍ppt课件

上传人:s9****2 文档编号:568293528 上传时间:2024-07-24 格式:PPT 页数:21 大小:594.50KB
返回 下载 相关 举报
ADFBCEO介绍ppt课件_第1页
第1页 / 共21页
ADFBCEO介绍ppt课件_第2页
第2页 / 共21页
ADFBCEO介绍ppt课件_第3页
第3页 / 共21页
ADFBCEO介绍ppt课件_第4页
第4页 / 共21页
ADFBCEO介绍ppt课件_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《ADFBCEO介绍ppt课件》由会员分享,可在线阅读,更多相关《ADFBCEO介绍ppt课件(21页珍藏版)》请在金锄头文库上搜索。

1、ADF-BC EO 介绍介绍资深技术顾问甲骨文 开发者计划ADF-BC Entities ObjectCharacteristics of Entity ObjectsEntity objects:Represent a row in a database table or other data sourceHandle database cachingContain attributes representing the database columnsEncapsulate attribute-level and entity-level validation logicCan conta

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

3、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 RowIDCreates implicit validators for database constraintsCreates the XML component definition file

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

5、rnate key entity constraintsRefactor (rename or move) objectsCreate and publish eventsValidate user input (presented in a later lesson)Many other modifications are possible with coding, such as:Overriding base class methodsImplementing calculation and recalculation of transient attributesDefining At

6、tribute Control Hints12AssociationsDefine a relationship between EOsFacilitate access to data in related entity objectsMay be based on database constraintsMay be independent of database constraintsAre used in defining validations and LOV metadataConsist of a source (master) and a destination (detail

7、) entitySourceDestinationOrdersPersonsFkASAssociationPersonsEOOrdersEOCreating AssociationsAutomatically created when creating 2nd EO with foreign keyCreating AssociationsUsing the Create Association wizardAssociation TypesAssociationEntities are related but not completely dependentEither end of the

8、 association can exist without the otherEither can be deleted without deleting the otherCompositionDestination entity is completely dependent on the source entityThe source entity owns the destination entityNo destination entity can be created without the owning entity existing firstThe source entit

9、y cannot be deleted without deleting all its associated destination entitiesUsing Alternate Key Entity ConstraintsAlternate keys are:Used for efficient uniqueness checksUsed for direct row lookups with findByKey() methodsDifferent from primary keys or unique keysRefactoring ObjectsWith refactoring y

10、ou can:Rename objects, such as associations and view linksMove objects or packages to a different packageChange all references throughout the applicationWorking Programatically with Entities and AssociationsFinding an Entity Object by Primary KeypublicStringfindOrderID(longorderId)StringentityName=o

11、racle.apps.str.model.entity.OrderEO;EntityDefImplorderDef=EntityDefImpl.findDefObject(entityName);KeyorderKey=newKey(newObjectorderId);EntityImplorder=orderDef.findByPrimaryKey(getDBTransaction(),orderKey);if(order!=null)return(String)order.getAttribute(“ShipToName);elsereturnnull;1234 publicStringg

12、etLocationId()returngetDepartmentEO().getLocationId();Traversing Associations:Source to DestinationThe destination entitys EntityImpl.java methods to get and set the source entity.For example, EmployeeEOImpl.java contains getDepartmentEO() and setDepartmentEO().You could add a method to EmployeeEO.j

13、ava to get the Location ID of the department to which the employee belongs:getEmployeeEO()DepartmentEODepartmentEOToEmployeeEOEmployeeEOgetDepartmentEO()getLocationId()Updating or Removingan Existing Entity RowpublicvoidupdateEmpEmail(longempId,StringnewEmail)EntityImplemp=retrieveEmployeeById(empId

14、);if(emp!=null)emp.setAttribute(“Email,newEmail);trygetDBTransaction().commit();catch(JboExceptionex)getDBTransaction().rollback();throwex;123Creating a New Entity RowpubliclongcreateProduct(Stringname,Stringdescription)StringentityName=“oracle.apps.str.model.entity.ProductEO;EntityDefImplproductDef

15、=EntityDefImpl.findDefObject(entityName);EntityImplnewProduct=productDef.createInstance2(getDBTransaction(),null);newProduct.setAttribute(Name,name);newProduct.setAttribute(Description,description);trygetDBTransaction().commit();catch(JboExceptionex)throwex;DBSequencenewIdAssigned=(DBSequence)newPro

16、duct.getAttribute(ProdId);returnnewIdAssigned.getSequenceNumber().longValue();12345Coding: The Supporting Java ClassesEntityImpl The entity classRepresents a row Provides getter and setter methodsEntityDefImplThe entity definition classRepresents the whole entityCan be used to modify the entity defi

17、nitionEntityCollImplRepresents the cached set of rows from the entityIt 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

18、log changes in another entitybeforeCommit() Use to validate multiple instances of the same entityremove() Use to log a deletion in an entityOverriding Base Class Methods Example: Updating a Deleted Flag Instead of Deleting Rows/InImpl.javapublicvoidremove()setDeleted(Y);super.remove();protectedvoiddoDML(intoperation,TransactionEvente)if(operation=DML_DELETE)operation=DML_UPDATE;super.doDML(operation,e);12

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 医学/心理学 > 基础医学

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号