-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MappingException: class not found while looking for property
PostPosted: Tue Mar 08, 2005 5:12 pm 
Newbie

Joined: Tue Mar 08, 2005 5:05 pm
Posts: 9
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 09, 2005 4:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to put the class on the classpath

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.