-->
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.  [ 7 posts ] 
Author Message
 Post subject: Ant hbm2ddl cant find the hbm.xml files
PostPosted: Wed Sep 07, 2005 1:11 pm 
Newbie

Joined: Wed Sep 07, 2005 1:07 pm
Posts: 4
I am useing hibernate 3

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/sks/</property>
<property name="connection.username">sks</property>
<property name="connection.password">sks</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping resource="./sks/datamodel/InventoryItem.hbm.xml"/>

</session-factory>

</hibernate-configuration>



<target name="ddl" >


<hibernatetool destdir="${sourcedir}" classpath="${sourcedir}">


<configuration configurationfile="${sourcedir}/hibernate.cfg.xml"/>


<!-- generate default .java files <hbm2java/> -->
<hbm2ddl drop="false"/> <!-- export schema to database. If outputfilename is provided a text file is generated instead. -->
</hibernatetool>

</target>


Top
 Profile  
 
 Post subject: and I get this exception
PostPosted: Wed Sep 07, 2005 1:16 pm 
Newbie

Joined: Wed Sep 07, 2005 1:07 pm
Posts: 4
C:\Documents and Settings\svcWBRSYS\workspace\Hello\build.xml:61: org.hibernate.MappingException: Error reading resource: ./sks/datamodel/InventoryItem.hbm.xml



Please help me


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 1:26 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Post all your mappings.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 1:27 pm 
Newbie

Joined: Wed Sep 07, 2005 1:07 pm
Posts: 4
This is the only one and the one its chokeing on


<?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>

<class name="sks.datamodel.InventoryItem" table="Inventory_Item">

<id name="id" column="Inventory_Item_Id">
<generator class="identity"/>
</id>

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


</class>



</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 1:49 pm 
Beginner
Beginner

Joined: Mon Oct 11, 2004 12:30 pm
Posts: 21
Did your ant script copy the hbm.xml files to the classpath?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 2:26 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Remove the ./ in the mapping resource

Also define the mapping file more verbosely, e.g. set the type for the column etc.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 3:04 pm 
Newbie

Joined: Wed Sep 07, 2005 1:07 pm
Posts: 4
I have another ant task that compiles and runs the class and successfully, but the only reason im doing this ant task is to generate the schema, because the

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

does not work.

I tryed taking the "./" out and am giveing a proper path the src/datamodel package is a few packages down from my ant base directory.

It sees the hibernate config file on the root of the ant base directory, but it wont recognise any folders down from it when the config file trys to add the hbm.xml files.

I really like the idea of hibernate, but it just isnt working for me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.