title: How to fix "java.sql.SQLSyntaxErrorException: Unknown column 'product0_.return_policy' in 'field list' " exception?
body: <p>I've been getting this &quot;SQLSyntaxErrorException:Unknown column 'product0_.return_policy' in 'field list'&quot; when I try to run the URL on my browser to <em>GET</em> all the <em>products</em>.</p>
  <p><a href="https://i.imgur.com/6bhhuk9.png" rel="nofollow noreferrer">Look here</a></p>
  <p><strong>The browser shows the below as well:</strong></p>
  <blockquote>
  <p>There was an unexpected error (type=Internal Server Error, status=500).
  could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet</p>
  </blockquote>
  <p><em>returnPolicy</em> is the only variable that's causing this problem. I'm able to successfully retrieve all the values from the database when I remove the variable itself from both the database and from the Product class in Java.</p>
  <p><strong>This is the <em>getAllProducts</em> method that is part of the RESTController:</strong></p>
  <pre><code>@RequestMapping(method=RequestMethod.GET, value=&quot;/products&quot;)
      public List&lt;Product&gt; getAllProducts() {
          return productService.getAllProducts();
      }
  </code></pre>
  <p>which works fine when I remove the returnPolicy variable altogether.</p>
  <p><a href="https://i.imgur.com/Z3jBW2k.png" rel="nofollow noreferrer">This</a> is the MySQL table description:</p>
  <p><strong>Values stored in returnPolicy column:</strong></p>
  <blockquote>
  <p>returnPolicy</p>
  </blockquote>
  <pre><code>  0 
    0 
    1 
    1 
    1 
  </code></pre>
  <p><strong>This is the code for the 'Product' model's variables:</strong></p>
  <pre><code>import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name=&quot;product&quot;)
  public class Product {
      
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private int id;
      private String name;
      private int price;
      private String vendor;
      private String description;
      private Boolean returnPolicy;
  </code></pre>
  <h2>ProductRepository</h2>
  <pre><code>@Repository public interface ProductRepository extends JpaRepository&lt;Product, String&gt;{ }
  </code></pre>
  <p>Is there a problem with the mapping between SQL tinyint(Boolean) and the Boolean type of Java?</p>