Skip to content

Commit 2edd328

Browse files
committed
Update readme with Ebean DatabaseBuilder
1 parent 44a1560 commit 2edd328

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Postgres, ClickHouse, CockroachDB, DB2, ElasticSearch, Hana, LocalDynamoDB, Loca
2626
<dependency>
2727
<groupId>io.ebean</groupId>
2828
<artifactId>ebean-test-containers</artifactId>
29-
<version>6.2</version>
29+
<version>7.13</version>
3030
<scope>test</scope>
3131
</dependency>
3232

@@ -65,12 +65,23 @@ The dbName needs to be a valid database name so please just use alpha and unders
6565
special characters. For example, with Postgres it needs to be a valid postgres database name.
6666

6767
```java
68-
PostgresContainer container = PostgresContainer.builder("14")
68+
PostgresContainer container = PostgresContainer.builder("17")
6969
.dbName("my_app1") // this needs to be unique, not clash with other projects
7070
.start();
7171

7272
```
7373

74+
Database containers can create an Ebean DatabaseBuilder and also a DataSourceBuilder.
75+
For full programmatic test setup like:
76+
```java
77+
PostgresContainer container = PostgresContainer.builder("17")
78+
.dbName("my_app1") // this needs to be unique, not clash with other projects
79+
.start();
80+
81+
DatabaseBuilder ebeanBuilder = container.ebean().builder();
82+
Database ebeanDatabase = ebeanBuilder.build();
83+
```
84+
7485
Some containers like Redis, Localstack, LocalDynamoDB, ElasticSearch, ClickHouse do not have a concept
7586
like "database" and instead multiple projects share a global namespace.
7687

0 commit comments

Comments
 (0)