I am trying to use the hibernatetool Ant task to perform DAO code generation using hbm2dao. I am using Hibernate 3.2.0.cr2 and Hibernate Tools 3.2.0 beta 6. Here is my Ant stuff:
Code:
<path id="toolslib">
<path location="${dir.lib}/hibernate-tools.jar" />
<path location="${dir.lib}/hibernate3.jar" />
<path location="${dir.lib}/freemarker.jar" />
<path location="${dir.lib}/hsqldb.jar}" />
<path location="${dir.lib}/commons-logging.jar" />
<path location="${dir.lib}/dom4j-1.6.1.jar" />
<path location="${dir.lib}/cglib-2.1_3.jar" />
<path location="${dir.lib}/commons-collections-2.1.1.jar" />
<path location="${dir.lib}/log4j.jar" />
</path>
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
<target name="hibernate-gen">
<hibernatetool>
<classpath refid="build.classpath" />
<configuration>
<fileset dir="${dir.src}">
<include name="**/*.hbm.xml" />
</fileset>
</configuration>
<hbm2dao destdir="${dir.gend}" />
</hibernatetool>
</target>
It actually generates the correct code (it appears), but at the end of the process it throws a NoClassDefFoundError. Here is the log4j output:
Code:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2dao (Generates a set of DAOs)
[hibernatetool] 08:53:58,656 INFO [Environment] Hibernate 3.2 cr2
[hibernatetool] 08:53:58,676 INFO [Environment] hibernate.properties not found
[hibernatetool] 08:53:58,686 INFO [Environment] Bytecode provider name : cglib
[hibernatetool] 08:53:58,696 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 08:53:59,006 INFO [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Auditlog.hbm.xml
[hibernatetool] 08:53:59,457 INFO [HbmBinder] Mapping class: com.me.client.hibernate.Auditlog -> AUDITLOG
[hibernatetool] 08:53:59,497 INFO [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Audittypelookup.hbm.xml
[hibernatetool] 08:53:59,567 INFO [HbmBinder] Mapping class: com.me.client.hibernate.Audittypelookup -> AUDITTYPELOOKUP
[hibernatetool] 08:53:59,577 INFO [Configuration] Reading mappings from file: C:\dev\clientOpen\src\com\me\client\hibernate\Transactionlog.hbm.xml
[hibernatetool] 08:53:59,737 INFO [HbmBinder] Mapping class: com.me.client.hibernate.Transactionlog -> TRANSACTIONLOG
[hibernatetool] 08:53:59,988 INFO [Version] Hibernate Tools 3.1.0.beta5
[hibernatetool] 08:54:00,969 INFO [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\TransactionlogHome.java
[hibernatetool] 08:54:00,979 INFO [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\AudittypelookupHome.java
[hibernatetool] 08:54:00,989 INFO [TemplateProducer] Writing daohome.ftl to C:\dev\clientOpen\gend\com\me\client\hibernate\AuditlogHome.java
BUILD FAILED
java.lang.NoClassDefFoundError: org/hibernate/engine/query/sql/NativeSQLQueryReturn
I can't find org.hibernate.engine.query.sql.NativeSQLQueryReturn anywhere - not in the 3.2cr2 codebase nor in the 3.1.3 codebase. Am I missing a file or is this a bug?