Environment: HibernateTools-3.2.4.GA-R200905070146-H18 Hibernate-3.3.2GA HSQLDB Ant 1.6 and Ant 1.7
[hibernate.cfg.xml] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.hsqldb.jdbc.JDBCDriver</property> <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost/icloud</property> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> <mapping resource="com/polliard/icloud/Author.hbm.xml"/> </session-factory> </hibernate-configuration>
[Author.hbm.xml] <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.polliard.icloud"> <class name="Author" table="AUTHOR"> <id name="authorID" column="ID"> <generator class="native"/> </id> <property name="authorName" column="NAME"/> <property name="authorEmail" column="EMAIL"/> </class> </hibernate-mapping>
[build.xml] <snip> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath"/> <target name="schemaexport" depends="compile, copymetafiles" description="Exports a generated schema to DB and file"> <hibernatetool destdir="${basedir}"> <classpath path="${build}"/> <configuration configurationfile="${build}/hibernate.cfg.xml"/> <hbm2ddl drop="true" create="true" export="true" outputfilename="${project.name}-ddl.sql" delimiter=";" format="true"/> </hibernatetool> </target> <target name="pojoexport" description="Produces Java classes from XML mappings"> <hibernatetool destdir="${basedir}/src"> <configuration> <fileset dir="${basedir}/src"> <include name="**/*.hbm.xml"/> </fileset> </configuration> <hbm2java jdk5="true"/> </hibernatetool> </target> </snip>
This is the output from the ant build [polliard@iron iCloud] ant pojoexport Buildfile: build.xml
pojoexport: [hibernatetool] Executing Hibernate Tool with a Standard Configuration [hibernatetool] 1. task: hbm2java (Generates a set of .java files) [hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). [hibernatetool] log4j:WARN Please initialize the log4j system properly. [hibernatetool] An exception occurred while running exporter #2:hbm2java (Generates a set of .java files) [hibernatetool] To get the full stack trace run ant with -verbose [hibernatetool] Failed in building configuration when adding /Users/polliard/Workspace/iCloud/src/com/polliard/icloud/Author.hbm.xml [hibernatetool] org.hibernate.InvalidMappingException: Could not parse mapping document from file /Users/polliard/Workspace/iCloud/src/com/polliard/icloud/Author.hbm.xml [hibernatetool] org.hibernate.MappingException: class com.polliard.icloud.Author not found while looking for property: authorID [hibernatetool] java.lang.ClassNotFoundException: com.polliard.icloud.Author [hibernatetool] A class were not found in the classpath of the Ant task. [hibernatetool] Ensure that the classpath contains the classes needed for Hibernate and your code are in the classpath.
What am I doing wrong. It is supposed to be generating the .java files that will be used to make the very class its complaining about... Thanks in advance for your help,
Thomas
|