| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Welcome to the PostgreSQL bookshop-java sample. It demonstrates how to build business applications using the CAP Java SDK using PostgreSQL. The application in this project enables browsing books and managing books.
This sample application shows how to conveniently create business applications based on CDS domain models, persisting data with PostgreSQL, and exposing an OData V4 frontend with an SAP Fiori frontend on top.
This sample uses Spring Boot as an application framework. Although a CAP Java application isn’t required to build on Spring Boot, it’s the first choice of framework, as it’s seamlessly integrated.
The domain models are defined using CDS entity definitions.
Services are defined using CDS Service Models. The OData V4 Protocol Adapter translates the CDS service models into corresponding OData schemas and maps the incoming OData requests to the corresponding CDS services.
A SAP Fiori UI is added using predefined SAP Fiori elements templates. SAP Fiori annotations add information to the service definitions, on how to render the data.
Framework and Infrastructure related Features:
Domain Model related Features:
User Interface related Features:
CDS Maven Plugin Features:
The following sections describe how to set up, build, and run the project.
Make sure you have set up a development environment (that means, you’ve installed the CDS Compiler, Java and Apache Maven) as described here. This sample also requires Docker Desktop or compatible alternative as described in testcontainers library documentation.
git clone https://github.com/SAP-samples/cloud-cap-samples-java.git mvn spring-boot:test-runIn the IDE use the TestApplication to run the application with the PostgreSQL container created by testcontainer.
This application is built to use only PostgreSQL as the database. It is used in the tests, can be started locally and, when deployed to SAP BTP, can use PostgreSQL service available there.
This sample uses Liquibase for deployment and evolution of database schema. You can find more on that in CAP Database Guide. Please be aware that Liquibase changed it's license to Functional Source License (FSL) with release 5.0. In case you want to use Liquibase >=5.0 outside of an sample application you have to check if the FSL licence is compatible with your application.
To start the application with built-in PostgresSQL container run mvn spring-boot:test-run. Make sure that you have Docker Desktop or compatible alternative up and running. You will see that application created PostgreSQL container, deployed the database there and your application is up and running.
Regular run with mvn spring-boot:run will require datasource to be specified explicitly. You may adapt the default configuration if you want to use this sample with persistent database or with PostgreSQL deployed in the cloud.
Unit tests require Docker environment and will fail if executed without one.
CAP Java applications can be deployed to the SAP Business Technology Platform as single tenant application.
Prerequisites:
Deploy Application:
In case you have a question, find a bug, or otherwise need support, please use our community. See the documentation at https://cap.cloud.sap for more details about CAP.
Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.
| Back | FazBrowse Home | New Git URL |