Skip to content

Commit 74e41f7

Browse files
committed
Add readme
1 parent 3a124d2 commit 74e41f7

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
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).

JdbcExamples/SpringDataJdbc/src/main/java/movie/springjdbc/Config.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ public class Config extends AbstractJdbcConfiguration {
3434
@Bean
3535
DataSource dataSource() throws SQLException {
3636
PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();
37-
dataSource.setUser("josh");
38-
dataSource.setPassword("Welcome123!");
3937
dataSource.setConnectionFactoryClassName("oracle.jdbc.replay.OracleDataSourceImpl");
40-
dataSource.setURL("jdbc:oracle:thin:@//oraclejson.com:1521/freepdb1");
38+
dataSource.setURL(System.getProperty("url"));
4139
dataSource.setInitialPoolSize(5);
4240
dataSource.setMinPoolSize(5);
4341
dataSource.setMaxPoolSize(10);

0 commit comments

Comments
 (0)