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
|