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

No projection #401

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions app/genres/fiori-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ using AdminService from '../../srv/admin-service';

annotate AdminService.GenreHierarchy with @Aggregation.RecursiveHierarchy#GenreHierarchy: {
$Type: 'Aggregation.RecursiveHierarchyType',
NodeProperty: node_id, // identifies a node
ParentNavigationProperty: parent // navigates to a node's parent
NodeProperty: ID, // identifies a node
ParentNavigationProperty: parnt // navigates to a node's parent
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a bug, which prevents us to use parent as name for the parent association

};

annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchy#GenreHierarchy: {
Expand Down
6 changes: 3 additions & 3 deletions db/books.cds
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ annotate Authors with
*/
entity Genres {
key ID : Integer;
node : Integer not null;
parent_node : Integer default 0;
name : localized String(255);
descr : localized String(1000);
parent : Association to one Genres on parent.node = parent_node;
parnt : Association to Genres;
children : Composition of many Genres
Copy link
Contributor

@etimr etimr Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a composition of many here? At the end we want to have a foreign key in the db table which is the result of parnt : Association to Genres;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a composition of many here? At the end we want to have a foreign key in the db table which is the result of parnt : Association to Genres;

It's already there on main. I kept it to minimize the delta to main. But I'm also fine with removing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've missed that it's already in main. You are right, we don't need to make any additional changes, that are not relevant for us.

on children.parnt = $self;
}
32 changes: 16 additions & 16 deletions db/data/my.bookshop-Genres.csv
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
ID;parent_node;name;node
10;;Fiction;10
11;10;Drama;11
12;10;Poetry;12
13;10;Fantasy;13
14;10;Science Fiction;14
15;10;Romance;15
16;10;Mystery;16
17;10;Thriller;17
18;10;Dystopia;18
19;10;Fairy Tale;19
20;;Non-Fiction;20
21;20;Biography;21
22;21;Autobiography;22
23;20;Essay;23
24;20;Speech;24
ID;parnt_ID;name
10;;Fiction
11;10;Drama
12;10;Poetry
13;10;Fantasy
14;10;Science Fiction
15;10;Romance
16;10;Mystery
17;10;Thriller
18;10;Dystopia
19;10;Fairy Tale
20;;Non-Fiction
21;20;Biography
22;21;Autobiography
23;20;Essay
24;20;Speech
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

<!-- DEPENDENCIES VERSION -->
<jdk.version>21</jdk.version>
<cds.services.version>3.4.0</cds.services.version>
<cds.services.version>3.5.0</cds.services.version>
<cloud.sdk.version>5.13.0</cloud.sdk.version>
<xsuaa.version>3.5.3</xsuaa.version>
<cf-java-logging-support.version>3.8.4</cf-java-logging-support.version>
<cds.cdsdk-version>8.4.1</cds.cdsdk-version>
<cds.cdsdk-version>8.5.0</cds.cdsdk-version>
</properties>

<modules>
Expand Down
6 changes: 1 addition & 5 deletions srv/admin-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ service AdminService @(requires : 'admin') {
entity Orders as select from my.Orders;
extend my.Genres with Hierarchy;

entity GenreHierarchy as projection on my.Genres {
node as node_id,
parent_node as parent_id,
*
} excluding { node, parent_node }
entity GenreHierarchy as projection on my.Genres;

@cds.persistence.skip
entity Upload @odata.singleton {
Expand Down
3 changes: 2 additions & 1 deletion srv/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
logging:
level:
'[com.sap.cds.auditlog]': DEBUG
com.sap.cds.auditlog: DEBUG
com.sap.cds.persistence.sql: DEBUG
spring:
jmx:
enabled: true
Expand Down