title: Creating a right substring function with JPA Criteria Builder
body: <p>I'm having a difficult time do the following with the JPA CriteriaBuilder:</p>
  
  <pre><code>SUBSTRING( field, LENGTH( field ) - 7 )
  </code></pre>
  
  <p>The database I am using does not have a RIGHT function, if it did I could just do the following:</p>
  
  <pre><code>builder.function( "RIGHT", String.class, fieldExp, builder.literal(7) );
  </code></pre>
  
  <p>But no dice. While CriteriaBuilder DOES have a substring function expression I cannot figure out how to do the substraction from LENGTH for the literal 7.</p>
  
  <p>Any thoughts? TIA</p>