Hi
In my scenario I am adding a 'role' to a 'person' during creation. I am intention is to do this using a deep insert by appending data an entity in the srv.before hook method during 'create'.
module.exports = (srv) => {
const {Patients, Person_Roles, Roles } = srv.entities
srv.before('CREATE','Patients', async (req) => {
var insertQuery = req.query.INSERT
var patient = insertQuery.entries[0]
//Get Patient Role via category 'PA'. Assume only one role for now.
//TODO: provide dialog to select which role in category PA to use.
const {SELECT} = cds.ql(req)
const role = await SELECT.one.from(Roles).where({ category : 'PA' })
patient = req.data
patient.roles.push({parent_ID: patient.ID, role_ID: role.role_ID })
})
}
While debugging i noticed that this method behaves differently when called via oData v2 verses oData v4 with oData v2 behaving as expected, whilst oData v4 fails to load all the elements from the Roles table.

Any idea why this would happen?