You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This directory contains examples of how to store and access JSON type values in Oracle Database from a Java program.
4
4
5
-
*[emp.CreateTable](src/main/java/emp/CreateTable.java) - Creates the employee table `emp` used by all the examples.
6
-
*[emp.Insert](src/main/java/emp/Insert.java) - Inserts three JSON values into the `emp` table.
7
-
*[emp.GetAll](src/main/java/emp/GetAll.java) - Gets all the JSON values from the `emp` table.
8
-
*[emp.Filter](src/main/java/emp/Filter.java) - Selects employees from the `emp` table where the salary attribute is greater than 30,000.
9
-
*[emp.Filter2](src/main/java/emp/Filter2.java) - Selects employees from the `emp` table that have the `created` attribute.
10
-
*[emp.Update](src/main/java/emp/Update.java) - Updates an employee record using whole document replacement.
11
-
*[emp.UpdateMerge](src/main/java/emp/UpdateMerge.java) - Performs a partial update using JSON_MERGEPATCH().
12
-
*[emp.UpdateTransform](src/main/java/emp/UpdateTransform.java) - Performs a partial update using JSON_TRANSFORM().
13
-
*[emp.JSONP](src/main/java/emp/JSONP.java) - Inserts and retrieves a value using [JSON-P (javax.json)](https://javaee.github.io/jsonp/) interfaces.
14
-
*[emp.JSONB](src/main/java/emp/JSONB.java) - Stores and retrieves a plain/custom Java object as JSON using [JSON-B (javax.json.bind)](https://javaee.github.io/jsonb-spec/).
15
-
*[emp.Jackson](src/main/java/emp/Jackson.java) - Encodes JSON from an external source, in this case a Jackson parser, as Oracle binary JSON and inserts it into the table.
16
-
*[emp.BinaryJson](src/main/java/emp/BinaryJson.java) - Encodes JSON text as Oracle binary JSON, stores it in a file, and then reads it back again.
17
-
*[emp.RunAll](src/main/java/emp/RunAll.java) - Runs all the examples at once.
18
-
*[emp.DropTable](src/main/java/emp/DropTable.java) - Drops the table used by the examples.
5
+
*[movie.CreateTable](src/main/java/movie/CreateTable.java) - Creates the movie table `movie` used by all the examples.
6
+
*[movie.Insert](src/main/java/movie/Insert.java) - Inserts three JSON values into the `movie` table.
7
+
*[movie.GetAll](src/main/java/movie/GetAll.java) - Gets all the JSON values from the `movie` table.
8
+
*[movie.Filter](src/main/java/movie/Filter.java) - Selects movies from the `movie` table where the salary attribute is greater than 30,000.
9
+
*[movie.Filter2](src/main/java/movie/Filter2.java) - Selects movies from the `movie` table that have the `created` attribute.
10
+
*[movie.Update](src/main/java/movie/Update.java) - Updates an movie record using whole document replacement.
11
+
*[movie.UpdateMerge](src/main/java/movie/UpdateMerge.java) - Performs a partial update using JSON_MERGEPATCH().
12
+
*[movie.UpdateTransform](src/main/java/movie/UpdateTransform.java) - Performs a partial update using JSON_TRANSFORM().
13
+
*[movie.JSONP](src/main/java/movie/JSONP.java) - Inserts and retrieves a value using [JSON-P (javax.json)](https://javaee.github.io/jsonp/) interfaces.
14
+
*[movie.JSONB](src/main/java/movie/JSONB.java) - Stores and retrieves a plain/custom Java object as JSON using [JSON-B (javax.json.bind)](https://javaee.github.io/jsonb-spec/).
15
+
*[movie.Jackson](src/main/java/movie/Jackson.java) - Encodes JSON from an external source, in this case a Jackson parser, as Oracle binary JSON and inserts it into the table.
16
+
*[movie.BinaryJson](src/main/java/movie/BinaryJson.java) - Encodes JSON text as Oracle binary JSON, stores it in a file, and then reads it back again.
17
+
*[movie.RunAll](src/main/java/movie/RunAll.java) - Runs all the examples at once.
18
+
*[movie.DropTable](src/main/java/movie/DropTable.java) - Drops the table used by the examples.
19
19
20
20
See also:
21
21
* Documentation: [The API for JSON type in Oracle Database (oracle.sql.json)](https://javadoc.io/static/com.oracle.database.jdbc/ojdbc8/21.4.0.0/oracle/sql/json/package-summary.html#package.description)
@@ -29,34 +29,9 @@ Need help, talk to us on Slack:
29
29
30
30
### Create a database
31
31
32
-
These steps show how to create an always-free Autonomous Database but any 21c or later version of Oracle Database will also work.
_It will ask for a credit card for identification purposes. Your card will not be charged unless you manually choose to upgrade out of the free-tier limits._
38
-
39
-
2. Sign-in to the cloud console and click on **Autonomous JSON Database** under **Oracle Database**. <br/>
3. Click **Create Autonomous Database**. When creating the database, ensure that
43
-
- Workload type **Transaction Processing** or **JSON** is selected
44
-
-**Always Free** is selected
45
-
- Version **21c** (or later) is selected
46
-
-**IMPORTANT**: 21c is required to run these examples. At the time of this writing, Autonomous 21c is only available in the Always Free Tier and is restricted to the regions (IAD - US East, PHX - US West, LHR - UK South, and FRA - Germany Central). If 21c is not available in your Cloud region, you can alternatively use [Oracle Database XE](https://www.oracle.com/database/technologies/xe-downloads.html) to run the database locally.
47
-
48
-
<imgsrc="img/workload.png"width="500px"/>
49
-
50
-
- Select "Secure access from allowed IPs and VCNs only" and add your current IP address. This makes it so access is only allowed from your current IP address. It also makes it so that Mutual TLS encryption is not required (you don't have to download the database wallet).
51
-
<imgsrc="img/acl.png"width="500px"/>
52
-
53
-
4. Once the database is created, click on **DB Connection**
54
-
55
-
<kbd><imgsrc="img/con1.png"width="500px"/></kbd>
56
-
57
-
Select TLS and copy the connection string by clicking "Copy". Use "tp" for transactional or operational workloads.
This directory contains a Spring Data JDBC example that uses JSON in Oracle Database to persist a sub-object.
2
+
3
+
The following table:
4
+
5
+
```
6
+
create table movie (
7
+
id number default movieidsequence.NEXTVAL primary key,
8
+
name varchar2(100),
9
+
details JSON
10
+
)
11
+
```
12
+
Stores instances of the class [Movie](src/main/java/movie/springjdbc/model/Movie.java).
13
+
The nested class [MovieDetails](src/main/java/movie/springjdbc/model/MovieDetails.java)
14
+
is stored within the details column as JSON.
15
+
16
+
JSON-B (jakarta.json.bind) is used to automatically convert the MovieDetails instances directly to from OSON in [Config.java](src/main/java/movie/springjdbc/Config.java).
0 commit comments