Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add hbm2java task to Ant in NetBeans
    primarykey
    data
    text
    <p>I'm trying to generate POJO's from mapping xml files. I read something about adding an ant task, to do it easily.</p> <p>I've added this xml below to my project's build-impl.xml in Netbeans, but nothing happens:</p> <pre><code>&lt;target name="codegen"&gt; &lt;echo&gt;Zippzip&lt;/echo&gt; &lt;taskdef name="hbm2java" classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask" classpathref="javac.classpath"/&gt; &lt;hbm2java output="generated/src/"&gt; &lt;fileset dir="cat/model/"&gt; &lt;include name="**/*.hbm.xml"/&gt; &lt;/fileset&gt; &lt;/hbm2java&gt; &lt;/target&gt; </code></pre> <p>I'm beginner to Netbeans, Ant and Hibernate, can anyone help me out?</p> <p>P.S. i don't really know what should 'classpathref' be. I mean i know it should contain the classpath to the hibernate's distribution. The real problem is that I don't know how to get an Ant task working..</p> <p><strong>Edit: I figured out that the script above doesn't work with Hibernate3.. I've got another script, but still not working. The error message shown is: Could not create type hibernatetool as the class class org.hibernate.tool.ant.Hbm2JavaExporterTask has no compatible constructor; And the script:</strong></p> <pre><code>&lt;target name="codegen"&gt; &lt;taskdef name="hibernatetool" classname="org.hibernate.tool.ant.Hbm2JavaExporterTask"&gt; &lt;classpath refid="project.classpath" /&gt; &lt;/taskdef&gt; &lt;hibernatetool destdir="cat/model/"&gt; &lt;configuration configurationfile="hibernate.cfg.xml"/&gt; &lt;hbm2java /&gt; &lt;/hibernatetool&gt; &lt;/target&gt; </code></pre> <p>This is Hibernate3 compatible, as I saw in the hibernate docs: <a href="http://docs.jboss.org/tools/2.1.0.Beta1/hibernatetools/html/ant.html#d0e2903" rel="nofollow noreferrer">http://docs.jboss.org/tools/2.1.0.Beta1/hibernatetools/html/ant.html#d0e2903</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload