title: Looking for an HQL builder (Hibernate Query Language)
body: <p>I'm looking for a builder for <a href="http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html" rel="noreferrer">HQL</a> in Java. I want to get rid of things like:</p>
  
  <pre><code>StringBuilder builder = new StringBuilder()
      .append("select stock from ")
      .append( Stock.class.getName() )
      .append( " as stock where stock.id = ")
      .append( id );
  </code></pre>
  
  <p>I'd rather have something like:</p>
  
  <pre><code>HqlBuilder builder = new HqlBuilder()
      .select( "stock" )
      .from( Stock.class.getName() ).as( "stock" )
      .where( "stock.id" ).equals( id );
  </code></pre>
  
  <p>I googled a bit, and I couldn't find one.</p>
  
  <p>I wrote a quick &amp; dumb <code>HqlBuilder</code> that suits my needs for now, but I'd love to find one that has more users and tests than me alone.</p>
  
  <p>Note: I'd like to be able to do things like this and more, which I failed to do with the Criteria API:</p>
  
  <pre><code>select stock
  from com.something.Stock as stock, com.something.Bonus as bonus
  where stock.someValue = bonus.id
  </code></pre>
  
  <p>ie. select all stocks whose property <code>someValue</code> points to <em>any</em> bonus from the Bonus table.</p>
  
  <p>Thanks!</p>