title: PostgreSQL: Query for specific field in json column
body: <p>I have a DB table that has a column named 'expected' which defined as json.</p>
  
  <p>and one of the rows in the db has the following value:</p>
  
  <pre><code>expected = {"min":5, "max":20, "league_id":7}
  </code></pre>
  
  <p>I'm trying to select this row using Hibernate as follow:</p>
  
  <pre><code>Object[] league = (Object[])session.createSQLQuery(
                  "SELECT id, name, type, expected, content " +
                  "FROM bonus " +
                  "WHERE CAST(expected-&gt;&gt;league_id as numeric)=7")
                  .uniqueResult();
  </code></pre>
  
  <p>I get the following exception:</p>
  
  <pre><code>[SqlExceptionHelper] - ERROR: column "league_id" does not exist
  </code></pre>
  
  <p>Why it tried to translate league_id into a column?</p>
  
  <p>by the way, if I try this query in my pgAdmin tool it works perfectly!</p>
  
  <p>Any help would be appreciated!
  Thanks.</p>