Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a custom function for Odata V4

0 Kudos
213
  • SAP Managed Tags:

I am trying to create some custom functions in OData V4 using JPA and Hibernate.

I have some sample code from a .NET app which works as expected

[EnableQuery(MaxTop = 100, MaxAnyAllExpressionDepth = 10, MaxExpansionDepth = 10)]
[HttpGet] public IActionResult ByName(string name) { try { var names = name.Yield().ToArray(); _
rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Starting");
return Ok(_ctx.Substances.Where(s => s.Names.Any( i => names.Contains(i))));
} catch (Exception e) { _
rxapiLogger.LogError(LOG_CATEGORY, "Substances by name query", e.Message, e);
return StatusCode(500);
} finally { _
rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Finished");
}
}




Would it be correct saying that this we be the same as named queries in Java?

Please can some one assist with perhaps an example on how to create custom functions for handling complex queries using the SAP OData V4 JPA library

0 REPLIES 0