@@ -246,3 +246,57 @@ dependencies {
246246 implementation 'com.oracle.database.spring:oracle-spring-boot-starter-wallet:24.4.0'
247247}
248248----
249+
250+ === Oracle JSON Collections
251+
252+ This starter provides dependencies and tooling for using JSON with Oracle Database, including Oracle Database JSON Relational Duality Views.
253+
254+ [source,xml]
255+ ----
256+ <dependency>
257+ <groupId>com.oracle.database.spring</groupId>
258+ <artifactId>oracle-spring-boot-starter-json-collections</artifactId>
259+ <version>24.4.0</version>
260+ </dependency>
261+ ----
262+
263+ For Gradle projects, add this dependency:
264+
265+ [source,subs="normal"]
266+ ----
267+ dependencies {
268+ implementation 'com.oracle.database.spring:oracle-spring-boot-starter-json-collections:24.4.0'
269+ }
270+ ----
271+
272+ ==== Using the Oracle JSON Collections Starter
273+
274+ The `JSONB` bean is used to convert Java Obects to and from OSON (Oracle Database serialized JSON), using the `fromOSON` and `toOSON` methods.
275+
276+ [source,java]
277+ ----
278+ @Autowired
279+ JSONB jsonb;
280+
281+ // Convert from OSON to Java Object
282+ Student student = jsonb.fromOSON(inputStream, Student.class);
283+ // Convert from Java Object to OSON
284+ byte[] bytes = jsonb.toOSON(student);
285+ ----
286+
287+ The `JSONBRowMapper` implementation converts OSON database columns to Java Objects:
288+
289+ [source,java]
290+ ----
291+ RowMapper<Student> rowMapper = new JSONBRowMapper<>(this.jsonb, Student.class);
292+ List<Student> students = jdbcTemplate.query(con -> {
293+ PreparedStatement ps = con.prepareStatement("""
294+ select * from students_dv v
295+ where v.data.first_name = ?
296+ and v.data.last_name = ?
297+ """);
298+ ps.setString(1, firstName);
299+ ps.setString(2, lastName);
300+ return ps;
301+ }, rowMapper);
302+ ----
0 commit comments