-->
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.  [ 3 posts ] 
Author Message
 Post subject: SchemaExport doesn't read my mapping files
PostPosted: Wed Oct 08, 2003 10:44 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
Hy there.
I'm having a problem puting SchemaExport to work.
He doesn't give any error (as the output below shows) and creates the output file "teste.ddl" but with nothing in it (zero length). The weird part is that even when I put some trash in the hibernate.cfg.xml file (for examples, "<mapping resource="xptoCat.hbm.xml"/>") it continues to give me the output below and the "xptoCat.hbm.xml" doesn't even exist.
PROBLEM: why isn't he reading my "mapping resources" in the hibernate.cfg.xml file!?
Please help.

A little test:

---------------
Cat.hbm.xml
---------------

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="Cat" table="cat">
<property name="id" column="cat_id"/>
<property name="name" column="name"/>
<property name="sex" column="sex"/>
</class>

</hibernate-mapping>

--------------------
hibernate.cfg.xml
--------------------

<?xml version='1.0'?>

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<!-- shared properties -->

<!-- a SessionFactory instance listed as /hibernate/sessionFactory -->
<session-factory name="/hibernate/sessionFactory">

<!-- mapping files -->
<mapping resource="Cat.hbm.xml"/>

</session-factory>

</hibernate-configuration>

-----------------------
hibernate.properties
-----------------------

hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:hsql://192.168.0.40:1701
hibernate.connection.username=sa

-----------------------------------
SchemaExport command used
-----------------------------------

java net.sf.hibernate.tool.hbm2ddl.SchemaExport --output=teste.ddl --text hibernate.cfg.xml

------------------------------
Output of command above
------------------------------

8/Out/2003 15:35:09 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.0.3
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties:{hibernate.connection.username=sa,hibernate.connection.password=, hibernate.cglib.use_reflection_optimizer=true,hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect, hibernate.connection.url=jdbc:hsqldb:hsql://192.168.0.40:1701, hibernate.connection.driver_class=org.hsqldb.jdbcDriver}
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Environment <clinit>
INFO: JVM proxy support: true
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Configuration addFile
INFO: Mapping file: hibernate.cfg.xml
8/Out/2003 15:35:09 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.HSQLDialect
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
8/Out/2003 15:35:09 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 2:48 pm 
Newbie

Joined: Wed Jun 02, 2004 2:46 pm
Posts: 1
How did you solve this problem?
it looks i am having the same problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 03, 2004 6:28 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
The Hibernate classes need to be on the Ant schemaexport calsspath.

Try that.


Sherman


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