title: Enum class not found when using EnumType in Hibernate hbm file
body: <p>I'm using hbm files to generate my POJO objects using hbm2java through an Ant task.  I'm trying to change some hard coded values to Enum using org.hibernate.type.EnumType in my XML:</p>
  
  <pre><code>&lt;set name="myCollection" table="table_name" lazy="true"&gt;
      &lt;key column="ref_id"/&gt;
      &lt;element column="col" not-null="true"&gt;
          &lt;type name="org.hibernate.type.EnumType"&gt;
              &lt;param name="enumClass"&gt;my.path.MyEnum&lt;/param&gt;
              &lt;param name="type"&gt;12&lt;/param&gt;
              &lt;param name="useNamed"&gt;true&lt;/param&gt;
          &lt;/type&gt;
      &lt;/element&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>My first attempt at running hbm2java resulted in 'Enum class not found' for MyEnum. I realized that I needed to add my classes to the classpath in my ant file:</p>
  
  <pre><code>&lt;hibernatetool destdir="${src.dir}"&gt;
      &lt;classpath&gt;
          &lt;path location="${build.dir}"/&gt;
      &lt;/classpath&gt;
      &lt;configuration configurationfile="${basedir}/sql/hibernate.cfg.xml" &gt;
          &lt;fileset dir="${src.dir}" id="id"&gt;
              &lt;include name="model/*.hbm.xml" /&gt;
          &lt;/fileset&gt;
      &lt;/configuration&gt;
  
      &lt;hbm2java ejb3="false" jdk5="true" /&gt;
  &lt;/hibernatetool&gt;
  </code></pre>
  
  <p>Everything worked this time, but it turns out it is only because I had already compiled everything in <code>${src.dir}</code> to <code>${build.dir}</code>.  If I start from a "clean" state, I get the 'Enum class not found' again because it has a circular dependency: In order to compile the code, I need the POJO's.  But in order to get the POJO's, I need the compiled code.</p>
  
  <p>The only solution I can think of is to Compile everything in the enum package first, then run hbm2java, then compile the rest.</p>
  
  <p>It seems strange to me, but is this the best solution? <strong>Or is there some other solution that I haven't thought of?</strong> For example, is there any way to have it look at my source code instead?</p>