title: @Formula annotation not understanding "count"
body: <p>I have an entity Group with a calculated property I'm trying to calculate with @Formula.</p>
  
  <p>There's other three entities that have a foreign key to this entity, and what I'm trying to calculate is how many entities depend on each Group entity, so the formula looks like this:</p>
  
  <pre><code>public class Group {
  
  ...
  
  @Formula("(select count (distinct (s.id)) + count(distinct(ses.id)) + count (distinct(u.id))
      from section s, session ses, user u, group_user gu
      where s.group_id = id and ses.group_id = id and gu.user_id = u.id and
            gu.group_id = id )")
      private int dependencies;
  }
  </code></pre>
  
  <p>But when I perform a findAll on Group it throws the exception:</p>
  
  <pre><code>ORA-00904: "GROUP0_"."COUNT": invalid identifier
  </code></pre>
  
  <p>And the generated SQL looks weird, like this:</p>
  
  <pre><code>    Hibernate: select * from ( select distinct group0_.id as id1_8_, group0_.active as active2_8_, group0_.code as code3_8_, 
  ... 
  (select group0_.count (distinct (s.id)) + count(distinct(ses.id)) + group0_.count (distinct(u.id)) from section s, session ses, user u, group_user gu where s.group_id = group0_.id and ses.group_id = group0_.id and gu.user_id = u.id and gu.group_id = group0_.id ) as formula1_ 
  from group group0_ where 1=1 order by group0_.code asc ) where rownum &lt;= ?
  </code></pre>
  
  <p>How should I write the formula to get it to work? </p>