Hello
Implementing a CAP application, I have the following data model:
entity Drivers : managed, cuid { seqID : Integer; firstName : String; ... vehicles : Association to many DriverVehicles on vehicles.driver= $self; } entity Vehicles : managed, cuid { seqID : Integer; numberPlate: String; ... drivers : Association to many DriverVehicles on drivers.vehicle= $self; } entity DriverVehicles { key driver : Association to Drivers; key vehicle : Association to Vehicles; }
Now, I would like to define a view so that I can utilise it in searching Drivers. Here, I need to be able to search by vehicle ID as well. So, I have the following view definition:
view DriverSearch as select from Drivers left outer join DriverVehicles on Drivers.ID = DriverVehicles.driver.ID left outer join Vehicles on Vehicles.ID = DriverVehicles.vehicle.ID { concat(Drivers.ID,Installations.ID) as recordID: String, key 'ABC' as key: String, Drivers.ID as driverID, Drivers.firstName, ... Vehicles.ID as vehicleID, Vehicles.numberPlate };
With a small tweak*, the above compiles and works well (almost**) in SQLite. However, when deployed, i.e. cds deploy, to HANA, it raises an error saying:
... Error: com.sap.hana.di.cds: Unmanaged associations cannot be used in the definition of an ON condition ...
Now, checking the CAP documentation for managed to-many associations, the above two seem to be managed associations. So, any idea where I am failing to set this properly assuming the above use case is supported?
Kind Regards
Serdar
* SQLite does not support concat(); hence, I change the line to:
... Drivers.ID || Installations.ID as recordID: String, ...
** To keep this question short, I will open another post if the problem also happens for HANA