-->
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: Schema Export can't find mapping files with Ant & XML Co
PostPosted: Mon Aug 16, 2004 11:26 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Hello All,

I've recently removed hibernate.properties in favor of the XML config file so I don't have to programmatically add my *.hbm.xml files when configuring. Apparently the schemaexport Ant task can also use this file at build time, which is desirable.

However, it refuses to find any of my mapping files, even though they are listed (config file attached below).

How does schemaexport know where to find the files listed in the XML config file? The task takes no base directory, and adding the nested fileset seems to make no difference. The directory containing the mapping files is passed to the schemaexport taskdef as part of its classpath. I'm a little stumped here. The task finds none of my mapping files, which are indeed there.

Hibernate version:
2.1.6

Full stack trace of any exception that occurs:
Schema text failed: Error reading resource: com/expn/vo/AddressVO.hbm.xml

XML Config File
Code:
<hibernate-configuration>

    <!-- SessionFactory (can't bind to JNDI in Tomcat, so element has no 'name' attribute -->
    <session-factory>

        <!-- properties -->
        <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
        <property name="connection.provider_class">com.expn.database.ExpConnectionProvider</property>
        <property name="show_sql">false</property>
        <property name="default_schema">expnew</property>
        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>

        <!-- mapping files -->
        <mapping resource="com/expn/vo/UserVO.hbm.xml"/>
        <mapping resource="com/expn/vo/UserRequestVO.hbm.xml"/>
        <mapping resource="com/expn/vo/ContactVO.hbm.xml"/>
        <mapping resource="com/expn/vo/AddressVO.hbm.xml"/>
        <mapping resource="com/expn/vo/ProductVO.hbm.xml"/>
        <mapping resource="com/expn/vo/AddressVO.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


Ant 1.5.4 build file snippets
Code:
   <taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
      <classpath>
         <path refid="classpath" />
         <pathelement location="${build.target}" />
      </classpath>
   </taskdef>

   <target name="gen-sql" description="Generates the database schema from HBM files">
      <schemaexport config="props/conf/hibernate.cfg.xml" quiet="no" text="yes" drop="no" delimiter=";" output="schema.sql">
           <fileset dir="${build.target}">
               <include name="**/*.hbm.xml"/>
           </fileset>
      </schemaexport>
   </target>



Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 11:59 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
FIXED. One of my entities was listed twice in the XML config file.

Sigh.

Thanks anyway,

Chris


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.