Hi,
I'm trying to use the hbm2java ant task. I have created a series of mapping files, one for each class. I'm using Hibernate 3.0.5 and hibernate-tools 3.0 alpha 4a.
When I build my ant target, I get the following error:
Code:
Buildfile: C:\somedir\mywork\buildrss\breaktracker\build.xml
ddl:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] [INFO] Environment - -Hibernate 3.0.5
[hibernatetool] [INFO] Environment - -hibernate.properties not found
[hibernatetool] [INFO] Environment - -using CGLIB reflection optimizer
[hibernatetool] [INFO] Environment - -using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] [INFO] Configuration - -Mapping file: C:\somedir\mywork\buildrss\breaktracker\src\mycompany\myproduct\tools\ailsa\model\Breakage.hbm.xml
[hibernatetool] [INFO] HbmBinder - -Mapping class: mycompany.myproduct.tools.ailsa.model.Breakage -> BREAKAGES
[hibernatetool] org.hibernate.MappingException: class mycompany.myproduct.tools.ailsa.model.Breakage not found while looking for property: id
[hibernatetool] at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
[hibernatetool] at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:360)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:294)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
[hibernatetool] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
[hibernatetool] at org.hibernate.cfg.Configuration.add(Configuration.java:362)
[hibernatetool] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
[hibernatetool] at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
SNIP
I'm confused by this error, because hbm2java seems to be looking for classes that I'm expecting it to actually generate the source code for. My buildfile looks like so:
Code:
<?xml version="1.0" encoding="windows-1252" ?>
<project name="breaktracker" default="init">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpath="lib/commons-collections-2.1.1.jar;
lib/dom4j-1.6.jar;
lib/hibernate3.jar;
lib/hibernate-tools.jar;
lib/jtidy-r8-21122004.jar;
lib/ocrs12.jar;
lib/ojdbc14.jar;
lib/ojdbc14dms.jar;
lib/orai18n.jar
lib/velocity-1.4.jar;
lib/velocity-tools-generic-1.1.jar"
/>
<target name="init">
<tstamp/>
</target>
<target name="ddl">
<mkdir dir="built" />
<hibernatetool destdir="built">
<configuration>
<fileset dir="src" id="id">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java />
</hibernatetool>
</target>
</project>
I can post the full content of my *.hbm.xml files if it's useful and relevant.
Any help / pointers to documentation / whatever would be most appreciated.
Thanks,
Brian[/code]