Skip to Content
0
Sep 08 at 08:47 PM

CAP : Modelling Arrayed Types in JAVA

160 Views Last edit Sep 08 at 08:48 PM 2 rev

Hello experts,

I am trying to model an arrayed type as per CAP's documentation in JAVA.
"Generic support in runtimes is added over time. It’s available in Node.js but not yet in Java. If not available, you need to add custom logic, for example, to serialize payloads into JSON strings and vice versa." -CAP Documentation


sample .cds Model (overly simplified but showcasing the array use-case)

entity Report{
  key customerId       : String;
      tenantId         : String;    
      scopeItems       : many ScopeItem;      
}
type ScopeItem{
  customerId  : String;
  scopeItemId : String;
  activated   : Boolean;
}


More Context :
I don't want to go with overly normalized tables and Associations as the use case is to provide an ODATA Layer over analytics reports coming as large .csv files generated from Python so it does not make sense to create tables for all entities as the schema is very dynamic.

Ask
1.
How can I serialize the payload in a Springboot Application ?
2. How can I write the data in sample .csv for local development and testing ?
3, If Array types is not the way to go any workarounds would be of great help.