<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to create a custom function for Odata V4 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-custom-function-for-odata-v4/m-p/12705135#M2018653</link>
    <description>&lt;P&gt;I am trying to create some custom functions in OData V4 using JPA and Hibernate.&lt;BR /&gt;&lt;BR /&gt;I have some sample code from a .NET app which works as expected&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;[EnableQuery(MaxTop = 100, MaxAnyAllExpressionDepth = 10, MaxExpansionDepth = 10)]&lt;BR /&gt; [HttpGet] public IActionResult ByName(string name) { 
    try { 
        var names = name.Yield().ToArray(); _&lt;BR /&gt;        rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Starting"); &lt;BR /&gt;        return Ok(_ctx.Substances.Where(s =&amp;gt; s.Names.Any( i =&amp;gt; names.Contains(i)))); &lt;BR /&gt;    } catch (Exception e) { _&lt;BR /&gt;        rxapiLogger.LogError(LOG_CATEGORY, "Substances by name query", e.Message, e); &lt;BR /&gt;        return StatusCode(500); &lt;BR /&gt;    } finally { _&lt;BR /&gt;        rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Finished"); &lt;BR /&gt;    } &lt;BR /&gt;} &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Would it be correct saying that this we be the same as named queries in Java? &lt;BR /&gt; &lt;BR /&gt;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 &lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2022 12:34:17 GMT</pubDate>
    <dc:creator>former_member1077671</dc:creator>
    <dc:date>2022-12-22T12:34:17Z</dc:date>
    <item>
      <title>How to create a custom function for Odata V4</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-custom-function-for-odata-v4/m-p/12705135#M2018653</link>
      <description>&lt;P&gt;I am trying to create some custom functions in OData V4 using JPA and Hibernate.&lt;BR /&gt;&lt;BR /&gt;I have some sample code from a .NET app which works as expected&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;[EnableQuery(MaxTop = 100, MaxAnyAllExpressionDepth = 10, MaxExpansionDepth = 10)]&lt;BR /&gt; [HttpGet] public IActionResult ByName(string name) { 
    try { 
        var names = name.Yield().ToArray(); _&lt;BR /&gt;        rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Starting"); &lt;BR /&gt;        return Ok(_ctx.Substances.Where(s =&amp;gt; s.Names.Any( i =&amp;gt; names.Contains(i)))); &lt;BR /&gt;    } catch (Exception e) { _&lt;BR /&gt;        rxapiLogger.LogError(LOG_CATEGORY, "Substances by name query", e.Message, e); &lt;BR /&gt;        return StatusCode(500); &lt;BR /&gt;    } finally { _&lt;BR /&gt;        rxapiLogger.LogInformation(LOG_CATEGORY, "Substances by name query", "Finished"); &lt;BR /&gt;    } &lt;BR /&gt;} &lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Would it be correct saying that this we be the same as named queries in Java? &lt;BR /&gt; &lt;BR /&gt;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 &lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 12:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-custom-function-for-odata-v4/m-p/12705135#M2018653</guid>
      <dc:creator>former_member1077671</dc:creator>
      <dc:date>2022-12-22T12:34:17Z</dc:date>
    </item>
  </channel>
</rss>

