-->
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: Generate DDL using hbm2ddl
PostPosted: Sat Feb 18, 2006 12:42 pm 
Newbie

Joined: Sat Feb 18, 2006 12:33 pm
Posts: 1
Hibernate version: version 3.1 rc3 and Hibernate Tools 3.1 beta 4

I can't get the ddl generated. Can anyone help me?


hibernate.properties

hibernate.query.substitutions yes 'Y', no 'N'

hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql://127.0.0.1/JForum
hibernate.connection.username JForum
hibernate.connection.password xxx

hibernate.connection.pool_size 1
hibernate.show_sql true
hibernate.format_sql true

log4j.properties

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n


log4j.rootLogger=warn, stdout

log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace

Post.hbm.xml

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="be.bobsworld.jforum.model.Post" table="Post">
<id name="id">
<generator class="hilo" />
</id>

<many-to-one name="parent" class="be.bobsworld.jforum.model.Post" column="parent_id" />

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

<property name="subject" type="string" />

<property name="text" type="string" />

<many-to-one name="user" class="be.bobsworld.jforum.model.User" column="user_id" />

<set name="childs">
<key column="parent_id" />
<one-to-many class="be.bobsworld.jforum.model.Post" />
</set>

</class>
</hibernate-mapping>

Build.xml

<?xml version="1.0"?>
<project name="JForum" default="schema">

<property file="build.properties" />

<path id="classpath">
<fileset dir="${dir.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${dir.src}">
<include name="**/*" />
</fileset>
<fileset dir="${dir.bin}">
<include name="**/*.class" />
</fileset>
</path>

<target name="schema">
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath" />
<hibernatetool destdir="${dir.output}}">
<classpath refid="classpath" />
<configuration propertyfile="${dir.src}/${dir.config}/hibernate.properties">
<fileset dir="${dir.src}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2ddl />
</hibernatetool>
</target>

</project>

output of build (schema)

Buildfile: D:\Programming\Projects\JForum-Core\build.xml
schema:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.1 rc3
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using CGLIB reflection optimizer
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.Configuration addFile
[hibernatetool] INFO: Reading mappings from file: D:\Programming\Projects\JForum-Core\src\be\bobsworld\jforum\model\Post.hbm.xml
[hibernatetool] 18-feb-2006 17:32:19 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: be.bobsworld.jforum.model.Post -> Post

BUILD FAILED
D:\Programming\Projects\JForum-Core\build.xml:20: Failed in building configuration when adding D:\Programming\Projects\JForum-Core\src\be\bobsworld\jforum\model\Post.hbm.xml

Total time: 1 second


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 5:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so there is a error in your Post.hbm.xml.

run it with ant -verbose and get the full stacktrace.

(btw. i've included a better error reporting into the cvs at least
it tells more without running with -verbose, see http://opensource2.atlassian.com/projec ... se/HBX-602)

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