JSON Relational Duality View - Part 1
- Sathishkumar Rangaraj
- Sep 16, 2024
- 2 min read

Overview
In this article i'll share about
What is JSON-Relational Duality View ?
Advantages of JSON Relational Duality View ( JDV )
Definition of JDV
When it can be used, in which use case ?
CRUD operations in JDV
Different access methods
Before to understand what is JDV, it would be good to know advantages and challenges between JSON Data model and Relational Data model
JSON Data Model
It is simple for any data,
Data can be represented in simple text format as Key value pairs.
It is simple to transmit between systems, because it is self-contained and self-describing , i.e
No need to create tables upfront ,
No schema design,
Fields can be added dynamically
Relational Data Model
Powerful for complexity
Combine basic normalized data using declarative SQL to create any application you want
Best fit for Integrity & Consistency
Stores in Row and Column format

What is JSON Relational Duality View (JDV)?
Architecturally provides the use-case simplicity of JSON with the multi-use case power of relational
Documents and Relational are Now Fully Unified
We get all the Benefits of Relational Plus All the Benefits of JSON
It provides best of Relational and JSON ( Best of Both worlds )
Internally , Data is stored as rows in tables to provide the benefits of the relational model
Data can be accessed as JSON documents to deliver the application simplicity of documents.

Advantages of JDV
Duality Views allows apps to access data in the form of JSON documents while maintaining extremely efficient normalized data storage in relational tables (figure 3). Thus, without sacrificing ease of use or efficiency, developers can use the highly effective relational model for data storage and think in terms of JSON documents for data access.
Furthermore, Duality Views offer document level serializability while concealing from the user all the complexities of database level concurrency control.

Definition of JDV
We can use either standard SQL or the easy-to-understand GraphQL syntax to create duality views over any number of tables.
As an example, the following Duality View turns the relational data from the student, student_course, course and teacher tables into a JSON document that mapped an app-tier student_schedule object using standard SQL:

The same view can be created using GraphQL along with DML restrictions ONLY for certain tables ( as in fig: 5)

Conclusion:
It is extremely useful for developers to have the ability able to get and store all the data they need for a single app-tier object in a single database action.
Applications that use Duality Views can now read a document from the view, make any changes they need, and then write the document back without having to worry about the data structure underneath.
In next blog we will continue to see in which use case JSON Relational Duality View would fit, CRUD Operations and different methods to access JDV.
For additional information , please refer oracle doc.
Thanks for your time.
Comments