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: hibernate tools cannot seem to locate my hbm files?
PostPosted: Wed Feb 21, 2007 8:05 pm 
Beginner
Beginner

Joined: Thu Jan 22, 2004 2:42 pm
Posts: 24
I'm trying to do a simple thing with hibernate3. I have a simple build.xml;
Code:
<?xml version="1.0"?>

<project name="example" basedir="." default="codegen">         

   <property name="src.dir" location="src" />

    <property name="build.dir" location="classes" />

    <property name="lib.dir" location="lib" />

   <property name="source.generated" location="/src/com/dukenet/fms/hibernate" />

   <property name="source.hibernate" location="/src/com/dukenet/fms/hibernate" />
   
   <path id="toolslib">
      <fileset dir="${lib.dir}">
          <include name="**/*.jar"/>
      </fileset>
   </path>


   
   <taskdef name="hibernatetool"
         classname="org.hibernate.tool.ant.HibernateToolTask"
         classpathref="toolslib" />

   <hibernatetool destdir="${source.generated}">
    <configuration configurationfile="${src.dir}/hibernate.cfg.xml"/>
    <hbm2java/>
   </hibernatetool>

   <target name="codegen"

               description="Generate Java source code

                            from the Hibernate mapping files">

         <hibernatetool/>

       </target>


</project>


working with a simple hibernate.cfg.xml;
Code:
<?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">



<!-- DO NOT EDIT: This is a generated file that is synchronized -->

<!-- by MyEclipse Hibernate tool integration.                   -->

<hibernate-configuration>



    <session-factory>

        <!-- properties -->

        <!--<property name="connection.username">...





</property>

        <pr   <property name="database.script.file"           value="${src.dir}/sql/${name}-mysql.sql"/>

      <property name="database.driver.file"           value="${lib.dir}/mysql-connector-java-3.0.14-production-bin.jar"/>

      <property name="database.driver.classpath"      value="${database.driver.file}"/>

      <property name="database.driver"                value="org.gjt.mm.mysql.Driver"/>

      <property name="database.url"                   value="jdbc:mysql://localhost/facility"/>

      <property name="database.userid"                ...>operty name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>-->
....
org.gjt.mm.mysql.Driver</property>


   <property name="hibernate.hbm2ddl.auto">create</property>

        <!-- mapping files -->

        <mapping resource="com/dukenet/facility/hibernate/Facility.hbm.xml"/>

   <mapping resource="com/dukenet/facility/hibernate/FacilityCategory.hbm.xml"/>

   <mapping resource="com/dukenet/facility/hibernate/FacilityContract.hbm.xml"/>

   <mapping resource="com/dukenet/facility/hibernate/FacilityEquipment.hbm.xml"/>

        <mapping resource="com/dukenet/facility/hibernate/FacilityLocation.hbm.xml"/>      

   <mapping resource="com/dukenet/facility/hibernate/FacilityType.hbm.xml"/>



    </session-factory>



</hibernate-configuration>


No matter what I do ant tells me it cannot locate Facility.hbm.xml;
Code:
<?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.dukenet.fms.hibernate.Facility">



        <class table="FACILITY">

                <id name="id" column="uid" type="long">

                        <generator class="increment"/>

                </id>


      <property name="date" type="timestamp"/>

                <property name="name" column="name"/>

               

                <one-to-one name="category" class="FacilityCategory"/>

            <one-to-one name="type" class="FacilityType"/>

            

            <!--Every Facility has a location-->

            <set name="facilityLocation" >

               <key column="id"/>

               <one-to-many class="FacilityLocation"/>

            </set>

            

            

        </class>



</hibernate-mapping>



It is located in the com/dukenet/facility/hibernate directory relevant to the hibernate.cfg.xml. It doesn't seem to be able to find the Facility.hbm.xml no matter how explicitly I specify it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 3:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you haven't specifed a classpath for the <hibernatetool> to use for looking up your resources.

_________________
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.