Hi guys, I'm trying my best to get the DDL generation to work but so far no luck. Here's the pertinent info:
hibernate version: 3.0beta4b
Ant build script:
<project name="cascada" default="schemaexport" basedir=".">
<description>Build the Cascada DB schema from hibernate files</description>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<path id="hibernate.path">
<fileset dir="WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="WEB-INF/classes">
<include name="**/*.class"/>
</fileset>
</path>
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="hibernate.path"/>
<target name="schemaexport">
<schemaexport
properties="buildschema.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="WEB-INF/src">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
</project>
adding a foreach loop over hibernate.path shows (just showing a bit here):
....
[echo] E:\eclipse\workspace\cascada\WEB-INF\classes\com\cascada\dataaccess\
Contact.class
....
And Contact.hbm.xml is:
<?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.cascada.dataaccess">
<class name="Contact">
<id name="id" type="int" unsaved-value="0" >
<column name="userID" sql-type="int" not-null="true"/>
<generator class="identity"/>
</id>
<property name="lastUsed"/>
<property name="nickName"/>
<!-- each contact has exactly one owner -->
<many-to-one name="Owner" column="userID" not-null="true"/>
</class>
</hibernate-mapping>
Now when I run the build I get:
E:\eclipse\workspace\cascada\buildschema.xml:25: Schema text failed: org.hibernate.MappingException: class com.cascada.dataaccess.Contact not found while looking for property: lastUsed
Here's the source of Contact.java (just a shell for proof of concept):
/*
* Created on Mar 7, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.cascada.dataaccess;
/**
* @author Sean
*
* TODO: Insert a description of the class here
*/
public class Contact
{
private String nickName = null;
private java.sql.Date lastUsed = null;
/**
* @return Returns the lastUsed.
*/
public java.sql.Date getLastUsed()
{
return lastUsed;
}
/**
* @param lastUsed The lastUsed to set.
*/
public void setLastUsed(java.sql.Date lastUsed)
{
this.lastUsed = lastUsed;
}
/**
* @return Returns the nickName.
*/
public String getNickName()
{
return nickName;
}
/**
* @param nickName The nickName to set.
*/
public void setNickName(String nickName)
{
this.nickName = nickName;
}
}
Any idea what I'm missing? The class in in the classpath but I'm sure it's something dumb on my end- feel free to pin the idiot tag on me just as long as you can point out the idiots mistake :)
|