Skip to content
Merged
Changes from 15 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
34 changes: 33 additions & 1 deletion java/migration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
synopsis: >
synopsis:
This chapter contains comprehensive guides that help you to work through migrations such as from CAP Java 1.x to CAP Java 2.x.
uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/65de2977205c403bbc107264b8eccf4b/9186ed9ab00842e1a31309ff1be38792.html
---

<script setup>
import Cds4j from './components/Cds4jLink.vue'
import CdsSrv from './components/CdsServicesLink.vue'
import { useData } from 'vitepress'
const { theme } = useData()
const { versions } = theme.value.capire
</script>


Expand All @@ -22,6 +25,34 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/

[[toc]]


## Automatic CAP Java Migrations with OpenRewrite { #open-rewrite }

For any Java related changes of the CAP Java APIs we try to make the transition from the old version to the new version as smooth as possible. Consequently, we provide [OpenRewrite recipes](https://docs.openrewrite.org) with migrations for our API changes so that larger projects can easily consume them.

### Moderne Platform

The CAP Java OpenRewrite recipe with our migrations can be found and used in the Moderne Platform.

### Execution of OpenRewrite Recipes with Maven

Alternatively, the application of these recipes is done via Maven as a one-shot operation. Take this call as an example:

```bash-vue
mvn org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=com.sap.cds:cds-services-recipes:{{ versions.java_services }} \
-Drewrite.activeRecipes=com.sap.cds.services.migrations.MigrateStatements \
-DskipMavenParsing=true
```

Here, the *migration* `com.sap.cds.services.migrations.MigrateStatements` from CAP Java's OpenRewrite Maven artifact `com.sap.cds:cds-services-recipes` is called in the given project context. The *migration* is a container for one or more recipes. A recipe is a rule that tells OpenRewrite how to transform code.

### Currently Released CAP Java Migrations

|Name |Description|Available since|
|--------|-----------|---------------|
|[com.sap.cds.services.migrations.MigrateStatements](../releases/2025/aug25#typed-query-results)|Migrates CQN statements to comply with typed Query API changes in 4.3.0.|4.3.0|

## CAP Java 3.10 to CAP Java 4.0 { #three-to-four }

### New License
Expand Down Expand Up @@ -1411,3 +1442,4 @@ After rebuilding and restarting your application, your Application Services are
<!-- TODO: Move this to "Development" section -->

<span id="afterenablingodata" />