Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: some edits #423

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions guides/databases-sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,34 @@ Further configuration depends on whether you run SQLite as an [in-memory databas

## Deployment

<div class="impl java">

### Initial Database Schema

Configure the build to create an initial _schema.sql_ file for SQLite using `cds deploy --to sqlite --dry > srv/src/main/resources/schema.sql`.

::: code-group
```xml [srv/pom.xml]
<execution>
<id>schema.sql</id>
<goals>
<goal>cds</goal>
</goals>
<configuration>
<commands>
<command>deploy --to sqlite --dry > srv/src/main/resources/schema.sql</command>
</commands>
</configuration>
</execution>
```
:::


[Learn more about creating an initial database schema](/java/persistence-services#initial-database-schema-1){.learn-more}

</div>


### In-Memory Databases

<div markdown="1" class="impl node">
Expand Down Expand Up @@ -114,11 +142,10 @@ Using in-memory databases is the most recommended option for test drives and tes
<div markdown="1" class="impl java">


The database content is stored in-memory. [Configure the build](../java/persistence-services#initial-database-schema-1) to create an initial _schema.sql_ file for SQLite using `cds deploy --to sqlite --dry > srv/src/main/resources/schema.sql`.

Finally, configure the DB connection in the non-productive `default` profile:
The database content is stored in-memory. Configure the DB connection in the non-productive `default` profile:

```yaml
::: code-group
```yaml [application.yaml]
---
spring:
config.activate.on-profile: default
Expand All @@ -132,6 +159,8 @@ spring:
maximum-pool-size: 1
max-lifetime: 0
```
:::


[Learn how to configure an in-memory SQLite database.](../java/persistence-services#in-memory-storage){.learn-more}

Expand Down
8 changes: 4 additions & 4 deletions java/persistence-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ To generate a `schema.sql` for PostgreSQL, use the dialect `postgres` with the `

```xml
<execution>
<id>cds</id>
<id>schema.sql</id>
<goals>
<goal>cds</goal>
</goals>
Expand Down Expand Up @@ -195,7 +195,7 @@ To generate a `schema.sql` for H2, use the dialect `h2` with the `cds deploy` co

```xml
<execution>
<id>cds</id>
<id>schema.sql</id>
<goals>
<goal>cds</goal>
</goals>
Expand All @@ -220,9 +220,9 @@ mvn com.sap.cds:cds-maven-plugin:add -Dfeature=H2 -Dprofile=default

To generate a `schema.sql` for SQLite, use the dialect `sqlite` with the `cds deploy` command: `cds deploy --to sqlite --dry`. The following snippet from _srv/pom.xml_ configures the [cds-maven-plugin](../java/development/#cds-maven-plugin) accordingly:

```xml
```xml [srv/pom.xml]
<execution>
<id>cds</id>
<id>schema.sql</id>
<goals>
<goal>cds</goal>
</goals>
Expand Down