title: Spring JPA query alternative to CAST(x as DECIMAL(y,z))
body: <p>I have this Spring JPA mySQL query</p>
  
  <pre><code>@Query("SELECT centro FROM 
   Centro centro WHERE CAST(y_geo as DECIMAL(20,10)) &lt; :y_geo + 0.1 
   AND CAST(y_geo as DECIMAL(20,10)) &gt; :y_geo - 0.1 
   AND CAST(x_geo as DECIMAL(20,10)) &lt; :x_geo + 0.1 
   AND CAST(x_geo as DECIMAL(20,10)) &gt; :x_geo - 0.1")
  </code></pre>
  
  <p>And returns this error</p>
  
  <pre><code>MismatchedTokenException: expecting CLOSE, found '('
  </code></pre>
  
  <p>I understand that it's not possible to nest 2 functions on JPA like here</p>
  
  <p><a href="https://stackoverflow.com/questions/36475872/spring-jpa-query-error-expecting-close-found-near">spring jpa @Query error, expecting CLOSE, found &#39;(&#39; near</a></p>
  
  <p>What it's the alternative to my query? 
  Thanks!</p>