版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、ADF-BC EO 介绍介绍资深技术顾问甲骨文 开发者计划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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《GB-T 37406-2019电子封装用球形二氧化硅微粉球形度的检测方法 颗粒动态光电投影法》专题研究报告
- 师德考核个人总结(幼儿教师版二)
- 建筑幕墙设计师创新应用评优考核试卷含答案
- 职业培训师诚信强化考核试卷含答案
- 脂肪酸酰化及酯化操作工岗前实操效果考核试卷含答案
- 纹版复制工创新意识强化考核试卷含答案
- 硅油及乳液生产工安全知识宣贯能力考核试卷含答案
- 城市轨道交通设备调度员岗位应急处置技术规程
- 有机介质电容器纸、膜切割工岗前技术应用考核试卷含答案
- 平板显示膜回收工岗前强化考核试卷含答案
- 公共危机管理(本)-第五次形成性考核-国开(BJ)-参考资料
- 安全教育主题班会-住校生的安全常识课件
- 严重精神障碍患者管理工作计划
- 细胞免疫荧光技术课件
- (完整版)耳鼻喉临床技术操作规范
- 【学考】高中物理会考(学业水平考试)公式及知识点总结
- GB∕T 25279-2022 中空纤维帘式膜组件
- 胃早癌的简述课件
- 主体结构分部工程验收汇报
- 医疗器械质量管理记录表格横表
- 北科大《冶金物理化学》期末总辅导(郭汉杰编写,非常有价值,完整版)
评论
0/150
提交评论