title: Hibernate - Avoiding unnecessary join when using foreign key in where clause
body: <p>I try to optimize the database queries in Hibernate, but I found a blocker:</p>
  
  <pre><code>&lt;class name="SupportedLanguageVO" table="AR_SUPPORTED_LANG" &gt;
      &lt;cache usage="read-only"/&gt;
   &lt;id name="Id" type="java.math.BigInteger"&gt;
    &lt;column name="ID" sql-type="NUMBER(20)" not-null="true"/&gt;
    &lt;generator class="assigned"/&gt;
   &lt;/id&gt;
      &lt;property name="OrderSeq" type="java.math.BigInteger"&gt;
    &lt;column name="ORDER_SEQ" sql-type="NUMBER(20)" not-null="true"/&gt;
   &lt;/property&gt;
      &lt;many-to-one name="Country" class="CountryVO" column="CTRY_CD_ID" cascade="none" &gt;
      &lt;many-to-one name="Language" class="LanguageVO" column="LANG_CD" cascade="none" &gt;
  
      &lt;/class&gt;
  </code></pre>
  
  <p>The primary key of the Country is the <code>CTRY_CD_ID</code>. If I run the following criteria</p>
  
  <pre><code>  Criteria crit = m_Session.createCriteria(SupportedLanguageVO.class);
              crit.createCriteria("Country").add(Restrictions.eq("_CountryCode", p_countrycode));
              crit.addOrder(Order.asc("OrderSeq"));
  </code></pre>
  
  <p>I can see, that hibernate joins the ctry and the AR_SUPPORTED_LANG tables.
  Why?
  It would be better to run</p>
  
  <pre><code>select * from AR_SUPPORTED_LANG where ctry_cd_id=?
  </code></pre>
  
  <p>sql rather than </p>
  
  <pre><code>select * from AR_SUPPORTED_LANG inner join ctry .... where ctry_cd_id=?
  </code></pre>
  
  <p>Can I force hibernate to run the first query?</p>