Hi,

I think the referential integrity mapping classes have not been found ...check 
the mappings for them and make sure u have created POJO for that class also.Try 
this..


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Thomas
Mader
Sent: Wednesday, May 18, 2005 5:16 PM
To: xdoclet-user@lists.sourceforge.net
Subject: [Xdoclet-user] schemaexport Problem; generated mappings not
correct?


I try to get my db schema exported but I get:
BUILD FAILED: /home/tezem/workspace/ExamProj/src/build.xml:49: Schema 
text failed: net.sf.hibernate.MappingException: persistent class 
[core.Answer] not found



Everything I tried was not working. So I think now the generated 
mappings are not correct in a way. Hopefully somebody could help me out.
Here you get my build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Project" basedir="." default="about">


   <target name="clean" depends="init" description="removes all 
directories related to this build">
      <delete dir="${dist}"/>
   </target>
      
   <target name="init" description="Initializes properties that are used 
by other targets.">
      <property name="dist" value="../dist"/>
   </target>
      
   <target name="prepare" depends="init,clean" description="creates dist 
directory">
      <echo message="Creating required directories..."/>
      <mkdir dir="${dist}"/>
   </target>   
      
   <target name="hibernate" depends="prepare"
          description="Generates Hibernate class descriptor files.">    
           
      <taskdef name="hibernatedoclet"
          classname="xdoclet.modules.hibernate.HibernateDocletTask">     
    
          <classpath>
         <fileset dir="../libs/">
             <include name="*.jar"/>
         </fileset>
          </classpath>         
      </taskdef>

      <!-- Execute the hibernatedoclet task -->
      <hibernatedoclet
         destdir="."
         excludedtags="@version,@author,@todo"
         force="true"
         verbose="true"
         mergedir="${dist}">
         
         <fileset dir="./">
             <include name="**/*.java"/>
         </fileset>

         <hibernate version="2.0"/>

      </hibernatedoclet>         
   </target>


   <target name="schemaexport">
      <taskdef name="schemaexport" 
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"/>
      <schemaexport properties="hibernate.properties" quiet="no" 
text="no" drop="no" delimiter=";" output="schema-export.sql">
         <fileset dir="./">
            <include name="**/*.hbm.xml" />
         </fileset>
      </schemaexport>
   </target>


   <target name="schemaupdate">
      <taskdef name="schemaupdate" 
classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask" />
      <schemaupdate properties="hibernate.properties" quiet="no">
         <fileset dir="./">
            <include name="**/*.hbm.xml" />
         </fileset>
      </schemaupdate>
   </target>


   <target name="about" description="about this build file" depends="init">
      <echo message="  Use this format for the arguments:"/>
      <echo message="      ant hibernate"/>
      <echo message="      ant schemaexport"/>
      <echo message=""/>         
   </target>
</project>



And here is my Answer.java:

package core;

public class Answer {
   
   private String answer = null;
   private boolean isCorrect = false;
   private String annotation = null;
   private long id;
   /**
    * Constructor of Class Answer
    * @param a sets the field answer to a
    * @param c sets isCorrect true if the anserwer is true
    */
   public Answer(String a, boolean c, String annotation)
   {
      this.answer=a;
      this.isCorrect=c;
      this.annotation = annotation;
   }

   /**
    * @hibernate.property
    * @return Returns the answer.
    */
   public String getAnswer() {
      return answer;
   }
   /**
    * @param answer The answer to set.
    */
   public void setAnswer(String answer) {
      this.answer = answer;
   }
   /**
    * @hibernate.property
    * @return Returns the isCorrect.
    */
   public boolean isCorrect() {
      return isCorrect;
   }
   /**
    * @param isCorrect The isCorrect to set.
    */
   public void setCorrect(boolean isCorrect) {
      this.isCorrect = isCorrect;
   }
   /**
    * @hibernate.property
    * @return Returns the annotation.
    */
   public String getAnnotation() {
      return annotation;
   }
   /**
    * @param annotation The annotation to set.
    */
   public void setAnnotation(String annotation) {
      this.annotation = annotation;
   }
   /**
    * @hibernate.id generator-class="sequence"
    * @return Returns the id.
    */
   public long getId() {
      return id;
   }
   /**
    * @param id The id to set.
    */
   public void setId(long id) {
      this.id = id;
   }
}



The generated Answer.hbm.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";>

<hibernate-mapping
 >
    <class
        name="core.Answer"
    >

        <id
            name="id"
            column="id"
            type="long"
        >
            <generator class="sequence">
              <!-- 
                  To add non XDoclet generator parameters, create a file 
named
                  hibernate-generator-params-Answer.xml
                  containing the additional parameters and place it in 
your merge dir.
              -->
            </generator>
        </id>

        <property
            name="answer"
            type="java.lang.String"
            update="true"
            insert="true"
            column="answer"
        />

        <property
            name="correct"
            type="boolean"
            update="true"
            insert="true"
            column="correct"
        />

        <property
            name="annotation"
            type="java.lang.String"
            update="true"
            insert="true"
            column="annotation"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Answer.xml
            containing the additional properties and place it in your 
merge dir.
        -->

    </class>

</hibernate-mapping>



At the moment the build.xml lies in the folder called "src" directly 
under the Project directory.
the Answer.java is under the src dir in the "core" Package, the 
Answer.hbm.xml is under "src" in the package "mappings.core" and because 
I am using Eclipse, all *.class files are in "bin" if this is important.
Also funny is that I was not able to give a destdir path in build.xml so 
that the mappings go into "src/core/mappings" instead of "src/mappings/core"


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
xdoclet-user mailing list
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to