SlideShare a Scribd company logo
Copyright © 2008, Oracle. All rights reserved.
Querying and Persisting Data
Copyright © 2008, Oracle. All rights reserved.
5 - 2
Objectives
After completing this lesson, you should be able to do the
following:
• Describe the characteristics of an ADF BC view object
• Create ADF BC view objects that can be used for data
queries in a Web application
• Modify SQL statements in view objects
• Explain how entity objects relate to database tables
• Describe the persistence mechanism of entity objects
• Create entity objects from database tables
• Create associations between entity objects
• Create updatable view objects based on entity objects
• Link view objects to one another
• Refactor business components
Copyright © 2008, Oracle. All rights reserved.
5 - 3
Using View Objects
CustomerStatus
CustomerStatusRO
Updatable
View Object
ID
Name
Status
Copyright © 2008, Oracle. All rights reserved.
5 - 4
Characteristics of a View Object (VO)
View objects:
• Represent a query
• Are used for joining, filtering, projecting, and sorting
business data
• Enable you to have a view of data that is specific to one
part of your application
• Can be constructed from a SQL statement, static values,
or populated programmatically
• Can also be based on any number of entity objects
View
objects
PriorityOrderVO ItemListVO
Reusable
Query Components
Copyright © 2008, Oracle. All rights reserved.
5 - 5
Creating View Objects for Queries
1
2
Invoke the Create View Object
Wizard. Initialize project for
Business Components.
Copyright © 2008, Oracle. All rights reserved.
5 - 6
Creating View Objects for Queries
3 Specify package, name, and kind of data.
Copyright © 2008, Oracle. All rights reserved.
5 - 7
Creating View Objects for Queries
4
Enter the SQL query,
or use Query Builder.
Copyright © 2008, Oracle. All rights reserved.
5 - 8
Creating View Objects for Queries
5
Create bind variables
and set attribute
properties as needed.
Copyright © 2008, Oracle. All rights reserved.
5 - 9
Creating View Objects for Queries
6 Optionally, create Java
classes (if adding
programmatic business
logic).
7
Optionally, create a new
application module or
add to an existing one.
Copyright © 2008, Oracle. All rights reserved.
5 - 10
Testing View Objects with the Business
Components Browser
1 Run the application module.
3
Double-click the
view object
instance.
2
Provide
connection
details.
Copyright © 2008, Oracle. All rights reserved.
5 - 11
Characteristics of an Entity Object (EO)
Entity 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 contain custom business methods
CustomerEO OrderEO
Copyright © 2008, Oracle. All rights reserved.
5 - 12
Using Entity Objects to Persist Data
CustomerEO
Id
Name
Status
Email
Entity
object
Attributes
Database
table
Status List
(Gold Silver Platinum)
Validation
rule
ID
201
NAME
Steve
STATUS
Gold
Email
msmith@company.com
202 Mike Silver dgonzales@company.com
CUSTOMERS
Copyright © 2008, Oracle. All rights reserved.
5 - 13
Creating Entity Objects
The Create Entity Object Wizard:
Name page
Attributes page
Attribute Settings page
Copyright © 2008, Oracle. All rights reserved.
5 - 15
Creating Entity Objects
from Tables, Views, or Synonyms
When you create an entity object, JDeveloper:
• Interrogates the data dictionary for information
• Infers primary key, or creates one from RowID
• Creates implicit validators for database constraints
• Creates the XML component definition file
(<EO_name>.xml)
• Creates optional Java files if selected, such as entity object
class <EO_name>Impl.java
• Generates associations based on foreign keys, if
applicable (<Association_name>FkAS.xml)
Copyright © 2008, Oracle. All rights reserved.
5 - 16
Synchronizing an Entity Object
with Changes to Its Database Table
ALTER TABLE USERS
ADD (security_question VARCHAR2(60));
Copyright © 2008, Oracle. All rights reserved.
5 - 17
Generating Database Tables from Entity Objects
Right-click package and
select Create Database
Objects.
In Create Database Objects
dialog box, select objects to
create.
Use with caution!
Copyright © 2008, Oracle. All rights reserved.
5 - 18
Characteristics of Associations
• 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)
and a destination (detail) entity
Source Destination
OrdersPersonsFkAS
Association
PersonEO OrderEO
Copyright © 2008, Oracle. All rights reserved.
5 - 19
Creating Associations
Use the Create Association Wizard:
Name page
Entity Object page
Association Properties page
Association Query page
Copyright © 2008, Oracle. All rights reserved.
5 - 20
Association Types
• Association
– Entities are related but not
completely 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 source entity.
– Source entity owns destination
entity.
– No destination entity can be
created without the owning entity
existing first.
– Source entity cannot be deleted
without deleting all its associated
destination entities.
Customer Order
Order Order Item
Copyright © 2008, Oracle. All rights reserved.
5 - 21
Characteristics of
Updatable View Objects
Entity Object View Object
select name, status
from customers
order by name
CustomerStatusVO
CustomerEO
ID
Name
Status
Email
Mike Silver
Steve Gold
Name Status
Database
Table
ID
201
NAME
Steve
STATUS
Gold
EMAIL
Steve@abc.com
202 Mike Silver Mike@abc.com
Copyright © 2008, Oracle. All rights reserved.
5 - 22
Creating Updatable View Objects
Name page
Use the Create View Object Wizard:
Entity Objects page
Copyright © 2008, Oracle. All rights reserved.
5 - 23
Creating Updatable View Objects:
Attributes and Settings
Attribute Settings page
Attributes page
Copyright © 2008, Oracle. All rights reserved.
5 - 25
Creating Updatable View Objects:
Query
Copyright © 2008, Oracle. All rights reserved.
5 - 27
Creating Updatable View Objects:
Additional Settings
Copyright © 2008, Oracle. All rights reserved.
5 - 28
Interaction Between Views and
Entities: Retrieving Data
• The view object queries the database directly.
• Data retrieved by the query is saved to the entity object’s
cache.
• Nonpersistent attributes are stored and retrieved from the
view object’s cache.
Select
VO
EO
Select
(12*monthly_sal)
VO
Copyright © 2008, Oracle. All rights reserved.
5 - 29
Interaction Between Views and
Entities: Updating Data
• The view object updates the entity object’s cache.
• The entity object commits to the database.
Update
EO VO
Commit
Copyright © 2008, Oracle. All rights reserved.
5 - 30
Creating a Join View Object
Join is based on
association
between
entities.
Copyright © 2008, Oracle. All rights reserved.
5 - 31
Including Reference Entities
in Join View Objects
1 2
3
Copyright © 2008, Oracle. All rights reserved.
5 - 32
Cascading Master–
Detail to Any Depth
Master to Single
Detail
Master to Multiple
Details
Creating Master–Detail Relationships
with View Objects
Different types of master–detail relationships are
supported.
Copyright © 2008, Oracle. All rights reserved.
5 - 33
Linking View Objects
Joined queries and view links
display information differently.
Use the Create View Link
Wizard to create a view link
between CustomerVO and
OrderVO view objects.
Copyright © 2008, Oracle. All rights reserved.
5 - 34
Comparing Join View Queries with View Links
Join view queries:
• Contain all attributes from main and referenced entities in
a single row
• WHERE clause relates key from main table with foreign key
in referenced tables
View link queries:
• Use a bind variable to relate detail records to key for
selected master record
• Append WHERE clause with bind variable to the base SQL
query for the source or destination view object
Copyright © 2008, Oracle. All rights reserved.
5 - 35
Refactoring Objects
With refactoring you can:
• Rename objects, such as
associations and view links
• Move objects or packages
to a different package
• Change all references
throughout the application
Copyright © 2008, Oracle. All rights reserved.
5 - 36
Summary
In this lesson, you should have learned how to:
• Describe the characteristics of an ADF BC view object
• Create ADF BC view objects that can be used for data
queries in a Web application
• Modify SQL statements in view objects
• Explain how entity objects relate to database tables
• Describe the persistence mechanism of entity objects
• Create entity objects from database tables
• Create associations between entity objects
• Create updatable view objects based on entity objects
• Link view objects to one another
• Refactor to move and rename associations and links
Copyright © 2008, Oracle. All rights reserved.
5 - 37
Practice 5 Overview:
Creating Entity Objects and View Objects
This practice covers the following topics:
• Creating read-only view objects to support LOVs
• Creating entity objects for tables that need to be updated
in the application
• Creating associations
• Creating updatable view objects
• Creating view links
• Refactoring associations and links

More Related Content

Similar to 05QueryingPersistingData.ppt

Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
richardrflores1
 
2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt
Chadharris42
 
apex-new-features-5486508.pptx
apex-new-features-5486508.pptxapex-new-features-5486508.pptx
apex-new-features-5486508.pptx
PriyankaPriyadarsin
 
Siebel Resume Arquitecture
Siebel Resume ArquitectureSiebel Resume Arquitecture
Siebel Resume Arquitecture
Jose Martinez
 
DTecH IT Education- Best Obiee training institute in bangalore
DTecH IT Education- Best Obiee training institute in bangaloreDTecH IT Education- Best Obiee training institute in bangalore
DTecH IT Education- Best Obiee training institute in bangalore
DTecH It Education
 
Oracle DV V4 new features overview
Oracle DV V4 new features overviewOracle DV V4 new features overview
Oracle DV V4 new features overview
Philippe Lions
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
Karen Benoit
 
Opinioz_intern
Opinioz_internOpinioz_intern
Opinioz_intern
Sai Ganesh
 
Oracle ADF (Application Development Framework) for Forms, Developers Slides
Oracle ADF (Application Development Framework) for Forms, Developers SlidesOracle ADF (Application Development Framework) for Forms, Developers Slides
Oracle ADF (Application Development Framework) for Forms, Developers Slides
Safi Ur Rehman
 
Oracle ad fforformsdevelopers_slides
Oracle ad fforformsdevelopers_slidesOracle ad fforformsdevelopers_slides
Oracle ad fforformsdevelopers_slides
Yogesh Sharma
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
Atlassian
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
Mohammed El Rafie Tarabay
 
Azure data catalog your data your way eugene polonichko dataconf 21 04 18
Azure data catalog your data your way eugene polonichko dataconf 21 04 18Azure data catalog your data your way eugene polonichko dataconf 21 04 18
Azure data catalog your data your way eugene polonichko dataconf 21 04 18
Olga Zinkevych
 
4) databases
4) databases4) databases
4) databases
techbed
 
OBIEE Online Training Institute in Hyderabad - C-Point
OBIEE Online Training Institute in Hyderabad - C-PointOBIEE Online Training Institute in Hyderabad - C-Point
OBIEE Online Training Institute in Hyderabad - C-Point
cpointss
 
Using object dependencies in sql server 2008 tech republic
Using object dependencies in sql server 2008   tech republicUsing object dependencies in sql server 2008   tech republic
Using object dependencies in sql server 2008 tech republic
Kaing Menglieng
 
Entity Frame Work Core.pptx
Entity Frame Work Core.pptxEntity Frame Work Core.pptx
Entity Frame Work Core.pptx
PrachiPatel779586
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOS
Kenny Nguyen
 
Lerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In AspnetLerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In Aspnet
Julie Lerman
 
Oracle Business Intelligence Enterprise Edition
Oracle Business Intelligence Enterprise EditionOracle Business Intelligence Enterprise Edition
Oracle Business Intelligence Enterprise Edition
ESRI Bulgaria
 

Similar to 05QueryingPersistingData.ppt (20)

Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt
 
apex-new-features-5486508.pptx
apex-new-features-5486508.pptxapex-new-features-5486508.pptx
apex-new-features-5486508.pptx
 
Siebel Resume Arquitecture
Siebel Resume ArquitectureSiebel Resume Arquitecture
Siebel Resume Arquitecture
 
DTecH IT Education- Best Obiee training institute in bangalore
DTecH IT Education- Best Obiee training institute in bangaloreDTecH IT Education- Best Obiee training institute in bangalore
DTecH IT Education- Best Obiee training institute in bangalore
 
Oracle DV V4 new features overview
Oracle DV V4 new features overviewOracle DV V4 new features overview
Oracle DV V4 new features overview
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
Opinioz_intern
Opinioz_internOpinioz_intern
Opinioz_intern
 
Oracle ADF (Application Development Framework) for Forms, Developers Slides
Oracle ADF (Application Development Framework) for Forms, Developers SlidesOracle ADF (Application Development Framework) for Forms, Developers Slides
Oracle ADF (Application Development Framework) for Forms, Developers Slides
 
Oracle ad fforformsdevelopers_slides
Oracle ad fforformsdevelopers_slidesOracle ad fforformsdevelopers_slides
Oracle ad fforformsdevelopers_slides
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
 
Azure data catalog your data your way eugene polonichko dataconf 21 04 18
Azure data catalog your data your way eugene polonichko dataconf 21 04 18Azure data catalog your data your way eugene polonichko dataconf 21 04 18
Azure data catalog your data your way eugene polonichko dataconf 21 04 18
 
4) databases
4) databases4) databases
4) databases
 
OBIEE Online Training Institute in Hyderabad - C-Point
OBIEE Online Training Institute in Hyderabad - C-PointOBIEE Online Training Institute in Hyderabad - C-Point
OBIEE Online Training Institute in Hyderabad - C-Point
 
Using object dependencies in sql server 2008 tech republic
Using object dependencies in sql server 2008   tech republicUsing object dependencies in sql server 2008   tech republic
Using object dependencies in sql server 2008 tech republic
 
Entity Frame Work Core.pptx
Entity Frame Work Core.pptxEntity Frame Work Core.pptx
Entity Frame Work Core.pptx
 
Iphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOSIphone programming: Core Data Tutorial for iOS
Iphone programming: Core Data Tutorial for iOS
 
Lerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In AspnetLerman Adx303 Entity Framework 4 In Aspnet
Lerman Adx303 Entity Framework 4 In Aspnet
 
Oracle Business Intelligence Enterprise Edition
Oracle Business Intelligence Enterprise EditionOracle Business Intelligence Enterprise Edition
Oracle Business Intelligence Enterprise Edition
 

Recently uploaded

Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 

Recently uploaded (20)

Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 

05QueryingPersistingData.ppt

  • 1. Copyright © 2008, Oracle. All rights reserved. Querying and Persisting Data
  • 2. Copyright © 2008, Oracle. All rights reserved. 5 - 2 Objectives After completing this lesson, you should be able to do the following: • Describe the characteristics of an ADF BC view object • Create ADF BC view objects that can be used for data queries in a Web application • Modify SQL statements in view objects • Explain how entity objects relate to database tables • Describe the persistence mechanism of entity objects • Create entity objects from database tables • Create associations between entity objects • Create updatable view objects based on entity objects • Link view objects to one another • Refactor business components
  • 3. Copyright © 2008, Oracle. All rights reserved. 5 - 3 Using View Objects CustomerStatus CustomerStatusRO Updatable View Object ID Name Status
  • 4. Copyright © 2008, Oracle. All rights reserved. 5 - 4 Characteristics of a View Object (VO) View objects: • Represent a query • Are used for joining, filtering, projecting, and sorting business data • Enable you to have a view of data that is specific to one part of your application • Can be constructed from a SQL statement, static values, or populated programmatically • Can also be based on any number of entity objects View objects PriorityOrderVO ItemListVO Reusable Query Components
  • 5. Copyright © 2008, Oracle. All rights reserved. 5 - 5 Creating View Objects for Queries 1 2 Invoke the Create View Object Wizard. Initialize project for Business Components.
  • 6. Copyright © 2008, Oracle. All rights reserved. 5 - 6 Creating View Objects for Queries 3 Specify package, name, and kind of data.
  • 7. Copyright © 2008, Oracle. All rights reserved. 5 - 7 Creating View Objects for Queries 4 Enter the SQL query, or use Query Builder.
  • 8. Copyright © 2008, Oracle. All rights reserved. 5 - 8 Creating View Objects for Queries 5 Create bind variables and set attribute properties as needed.
  • 9. Copyright © 2008, Oracle. All rights reserved. 5 - 9 Creating View Objects for Queries 6 Optionally, create Java classes (if adding programmatic business logic). 7 Optionally, create a new application module or add to an existing one.
  • 10. Copyright © 2008, Oracle. All rights reserved. 5 - 10 Testing View Objects with the Business Components Browser 1 Run the application module. 3 Double-click the view object instance. 2 Provide connection details.
  • 11. Copyright © 2008, Oracle. All rights reserved. 5 - 11 Characteristics of an Entity Object (EO) Entity 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 contain custom business methods CustomerEO OrderEO
  • 12. Copyright © 2008, Oracle. All rights reserved. 5 - 12 Using Entity Objects to Persist Data CustomerEO Id Name Status Email Entity object Attributes Database table Status List (Gold Silver Platinum) Validation rule ID 201 NAME Steve STATUS Gold Email msmith@company.com 202 Mike Silver dgonzales@company.com CUSTOMERS
  • 13. Copyright © 2008, Oracle. All rights reserved. 5 - 13 Creating Entity Objects The Create Entity Object Wizard: Name page Attributes page Attribute Settings page
  • 14. Copyright © 2008, Oracle. All rights reserved. 5 - 15 Creating Entity Objects from Tables, Views, or Synonyms When you create an entity object, JDeveloper: • Interrogates the data dictionary for information • Infers primary key, or creates one from RowID • Creates implicit validators for database constraints • Creates the XML component definition file (<EO_name>.xml) • Creates optional Java files if selected, such as entity object class <EO_name>Impl.java • Generates associations based on foreign keys, if applicable (<Association_name>FkAS.xml)
  • 15. Copyright © 2008, Oracle. All rights reserved. 5 - 16 Synchronizing an Entity Object with Changes to Its Database Table ALTER TABLE USERS ADD (security_question VARCHAR2(60));
  • 16. Copyright © 2008, Oracle. All rights reserved. 5 - 17 Generating Database Tables from Entity Objects Right-click package and select Create Database Objects. In Create Database Objects dialog box, select objects to create. Use with caution!
  • 17. Copyright © 2008, Oracle. All rights reserved. 5 - 18 Characteristics of Associations • 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) and a destination (detail) entity Source Destination OrdersPersonsFkAS Association PersonEO OrderEO
  • 18. Copyright © 2008, Oracle. All rights reserved. 5 - 19 Creating Associations Use the Create Association Wizard: Name page Entity Object page Association Properties page Association Query page
  • 19. Copyright © 2008, Oracle. All rights reserved. 5 - 20 Association Types • Association – Entities are related but not completely 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 source entity. – Source entity owns destination entity. – No destination entity can be created without the owning entity existing first. – Source entity cannot be deleted without deleting all its associated destination entities. Customer Order Order Order Item
  • 20. Copyright © 2008, Oracle. All rights reserved. 5 - 21 Characteristics of Updatable View Objects Entity Object View Object select name, status from customers order by name CustomerStatusVO CustomerEO ID Name Status Email Mike Silver Steve Gold Name Status Database Table ID 201 NAME Steve STATUS Gold EMAIL Steve@abc.com 202 Mike Silver Mike@abc.com
  • 21. Copyright © 2008, Oracle. All rights reserved. 5 - 22 Creating Updatable View Objects Name page Use the Create View Object Wizard: Entity Objects page
  • 22. Copyright © 2008, Oracle. All rights reserved. 5 - 23 Creating Updatable View Objects: Attributes and Settings Attribute Settings page Attributes page
  • 23. Copyright © 2008, Oracle. All rights reserved. 5 - 25 Creating Updatable View Objects: Query
  • 24. Copyright © 2008, Oracle. All rights reserved. 5 - 27 Creating Updatable View Objects: Additional Settings
  • 25. Copyright © 2008, Oracle. All rights reserved. 5 - 28 Interaction Between Views and Entities: Retrieving Data • The view object queries the database directly. • Data retrieved by the query is saved to the entity object’s cache. • Nonpersistent attributes are stored and retrieved from the view object’s cache. Select VO EO Select (12*monthly_sal) VO
  • 26. Copyright © 2008, Oracle. All rights reserved. 5 - 29 Interaction Between Views and Entities: Updating Data • The view object updates the entity object’s cache. • The entity object commits to the database. Update EO VO Commit
  • 27. Copyright © 2008, Oracle. All rights reserved. 5 - 30 Creating a Join View Object Join is based on association between entities.
  • 28. Copyright © 2008, Oracle. All rights reserved. 5 - 31 Including Reference Entities in Join View Objects 1 2 3
  • 29. Copyright © 2008, Oracle. All rights reserved. 5 - 32 Cascading Master– Detail to Any Depth Master to Single Detail Master to Multiple Details Creating Master–Detail Relationships with View Objects Different types of master–detail relationships are supported.
  • 30. Copyright © 2008, Oracle. All rights reserved. 5 - 33 Linking View Objects Joined queries and view links display information differently. Use the Create View Link Wizard to create a view link between CustomerVO and OrderVO view objects.
  • 31. Copyright © 2008, Oracle. All rights reserved. 5 - 34 Comparing Join View Queries with View Links Join view queries: • Contain all attributes from main and referenced entities in a single row • WHERE clause relates key from main table with foreign key in referenced tables View link queries: • Use a bind variable to relate detail records to key for selected master record • Append WHERE clause with bind variable to the base SQL query for the source or destination view object
  • 32. Copyright © 2008, Oracle. All rights reserved. 5 - 35 Refactoring Objects With refactoring you can: • Rename objects, such as associations and view links • Move objects or packages to a different package • Change all references throughout the application
  • 33. Copyright © 2008, Oracle. All rights reserved. 5 - 36 Summary In this lesson, you should have learned how to: • Describe the characteristics of an ADF BC view object • Create ADF BC view objects that can be used for data queries in a Web application • Modify SQL statements in view objects • Explain how entity objects relate to database tables • Describe the persistence mechanism of entity objects • Create entity objects from database tables • Create associations between entity objects • Create updatable view objects based on entity objects • Link view objects to one another • Refactor to move and rename associations and links
  • 34. Copyright © 2008, Oracle. All rights reserved. 5 - 37 Practice 5 Overview: Creating Entity Objects and View Objects This practice covers the following topics: • Creating read-only view objects to support LOVs • Creating entity objects for tables that need to be updated in the application • Creating associations • Creating updatable view objects • Creating view links • Refactoring associations and links