Showing results for 
Search instead for 
Did you mean: 

Deploying domain model when reusing CAP Java Service

0 Kudos

I am trying to initialize my bookstore database with the defined domain model and sample data but I when I run npm run deploy, I get the error message shown in the first picture below. I will be grateful for any tips to complete this mission.


namespace sap.capire.bookstore;

    using { Currency, cuid, managed }      from '@sap/cds/common';
    using { sap.capire.products.Products } from '@sap/capire-products';

    entity Books as projection on Products; extend Products with {
        // Note: we map Books to Products to allow reusing AdminService as is
        author : Association to Authors;

    entity Authors : cuid {
        firstname : String(111);
        lastname  : String(111);
        books     : Association to many Books on = $self;

    @Capabilities.Updatable: false
    entity Orders : cuid, managed {
        items    : Composition of many OrderItems on items.parent = $self;
        total    : Decimal(9,2) @readonly;
        currency : Currency;

    @Capabilities.Updatable: false
    entity OrderItems : cuid {
        parent    : Association to Orders not null;
        book_ID   : UUID;
        amount    : Integer;
        netAmount : Decimal(9,2) @readonly;

    using { sap.capire.bookstore as db } from '../db/schema';

    // Define Books Service
    service BooksService {
        @readonly entity Books as projection   on db.Books { *, category as genre } excluding { category, createdBy, createdAt, modifiedBy, modifiedAt };
        @readonly entity Authors as projection on db.Authors;

    // Define Orders Service
    service OrdersService {
        entity Orders as projection on db.Orders;
        // OrderItems are auto exposed

    // Reuse Admin Service
    using { AdminService } from '@sap/capire-products';
    extend service AdminService with {
        entity Authors as projection on db.Authors;

//Jason package
    "name": "bookstore",
    "version": "1.0.0",
    "description": "Generated by cds-services-archetype",
    "license": "ISC",
    "repository": "<Add your repository here>",
    "scripts": {
        "build": "cds build/all --clean",
        "schema": "cds compile srv --to sql > srv/src/main/resources/schema.sql",
        "deploy": "cds deploy"
    "dependencies": {
        "@sap/capire-products": "file:sap-capire-products-1.0.0.tgz",
        "@sap/cds": "3.31.2"
    "cds": {
        "build": {
            "target": "."
        "requires": {
            "db": {
                "kind": "sqlite",
                "model": [
                "credentials": {
                    "database": "sqlite.db"
        "odata": {
            "version": "v4"
    "devDependencies": {
        "sqlite3": "^4.2.0"

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor

I would suggest you compare your project with the openSAP-week2-unit2 branch of cloud-cap-samples.

0 Kudos

Thank you! Indeed to you pointed to me to the right direction and much more. The course is a perfect match for what am trying to learn!

Answers (0)