cancel
Showing results for 
Search instead for 
Did you mean: 

[cds] - [WARNING] Do not use “@cds.persistence.exists” on an entity

pepl
Active Participant
0 Kudos

Hi!

Could you please explain what does this warning mean?

cds] - [WARNING] db/models/bizent/schema.cds:2:8: Do not use “@cds.persistence.exists” on an entity named “hdw_bizent.adm.data.cdsBizent.Asset” in SAP HANA CDS when we also create a SAP HANA CDS context named “hdw_bizent.adm.data.cdsBizent” (in entity:"hdw_bizent.adm.data.cdsBizent.Asset")

After upgrading to a recent version we started having tons of such messages ( we have around 100 existing tables ). Tables are defined like this:

@cds.persistence.exists 
Entity ![hdw_bizent.adm.data.cdsBizent.Asset] {
key 	![ASSET_ID]: String(100)  @title: 'ASSET_ID: Asset Id' ; 
key 	![ASSET_TYPE]: String(100)  @title: 'ASSET_TYPE: Asset Type' ; 
	![ASSET_NAME]: String(255)  @title: 'ASSET_NAME: Asset Name' ; 
}

and later consume like this ( converting name to a lower case for rest api )

using {hdw_bizent} from './schema';
entity views.hdw_bizent.adm.data.cdsBizent.Asset as projection on hdw_bizent.adm.data.cdsBizent.Asset {
	ASSET_ID as asset_id,
	ASSET_TYPE as asset_type,
	ASSET_NAME as asset_name,
};

the real table name is resolved in synonyms.

What is wrong here and why it is a warning? Won't it appear then later to be an error?

Thanks!

patricebender
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

HANA CDS did not operate as expected when external artifacts (eg. hdbviews) live in a CDS namespace. This situation led to an HDI activation-order dependent HANA CDS compiler error.

Did you have issues activating your model? Could you share your cds-compiler options with me?

Best Regards,

Patrice

pepl
Active Participant
0 Kudos

please see my respond below. Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

patricebender
Product and Topic Expert
Product and Topic Expert

Hi pepl.booking,

We just released sap/cds-compiler@2.12.0, it contains a fix, which should eliminate the warnings if nothing is wrong with your model. Could you please check if this resolves the reported Issue?

Thanks and Best Regards,

Patrice

pepl
Active Participant
0 Kudos

Hi! Now I have way less warnings. Thank you for a quick fix.

Answers (1)

Answers (1)

pepl
Active Participant
0 Kudos

patricetao here is my cdsrc.json:

{
    "requires": {
        "db": {
            "kind": "hana",
            "model": [
                "db",
                "srv"
            ]
        },
        "uaa": {
            "kind": "xsuaa"
        },
        "auth": {
            "impl": "srv/auth.js"
        }
    },
    "_hana": {
        "deploy-format": "hdbtable"
    },
    "build": {
        "nodejs": {
            "edmxgeneration": true
        },
        "target": ".",        
        "tasks": [
            {
                "for": "hana",                
                "src": "db",
                "options": {
                    "model": [
                        "db",
                        "srv"
                    ]
                }
            },
            {
                "for": "node-cf",
                "src": "srv",
                "options": {
                    "model": [
                        "db",
                        "srv"
                    ]
                }
            }
        ]
    },
    "features": {
        "graphql": true
    },
    "odata": {
        "version": "v4"
    },
    "data": {
        "sql_mapping": "quoted"    },
    "auth": {
        "passport": {
            "strategy": "xsuaa"
        }
    },
    "deploy": {"no_save": true}    
}

I think sql_mapping:quoted allows me not have an error during deploy. Meanwhile could you be so kind to advise how should my model look like please? Do I need to use using something like hdw_bizent as hdw_bizent_renamed?

Thanks!

patricebender
Product and Topic Expert
Product and Topic Expert

Hi Petr,

thanks for your config. We think we might issue this warning too often.
We will investigate this and let you know as soon as we have a solution.

One more question though, I assume your model deploys just fine?

Best Regards,

Patrice

pepl
Active Participant

patricetao this is correct. luckily is just the warning - real generated code works fine.