-->
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.  [ 6 posts ] 
Author Message
 Post subject: hbm2ddl produces no output but no errors (same w/hbm2hbmxml)
PostPosted: Tue Jan 16, 2007 7:10 pm 
Newbie

Joined: Wed Sep 29, 2004 8:06 pm
Posts: 4
I am Running ant script and trying to generate DDL via hbm2ddl and I get no output. When I add -verbose -debug I get more info but no obvious (to me) errors that I can tell.

I run ANT at command line and in IDEA6.0 same result. Or lack of result. I appeneded it below. One thing that seems fishy is I am using JDK1.5 but there is a line ...
[hibernatetool] 2007-01-16 14:41:15,986 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling

little strange.


First Post I appreciate any help.
Gracias!


I did notice similar issues but those solutions did not apply or I had already encorporated them.

Hibernate 3.2.1
latest annotations
Hibernate-tools beta9
JDK 1.5




hibernate.cfg.xml:
<hibernate-configuration>

<session-factory>

<!-- properties -->
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>

<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="conection.url">jdbc:mysql://localhost:3306/sms</property>
<property name="conection.username">sms</property>
<property name="connection.password">XXXX</property>
<property name="connection.pool_size">1</property>
<property name="connection.statement_cache.size">25</property>

<!-- mappings -->
<mapping class="com.sms.model.Entree"/>
<mapping class="com.sms.model.Wine"/>

</session-factory>

</hibernate-configuration>

build.xml:
<project name="sms" default="generate-ddl" basedir=".">

<property file="build.properties"/>
<property name="web.dir" value="../deploy/webapps/web"/>
<property name="src.dir" location="src/java"/>
<property name="build.dir" location="${web.dir}/WEB-INF/classes"/>


<path id="tasks.classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${web.dir}/WEB-INF/classes"/>
<pathelement path="${web.dir}/WEB-INF/config"/>
</path>

<target name="generate-ddl">
<echo message="Start generate-ddl"/>
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
<echo message="Running generate-ddl"/>
<mkdir dir="${schema.output.dir}" />
<hibernatetool destdir="${schema.output.dir}">
<classpath refid="tasks.classpath"/>
<annotationconfiguration configurationfile="${web.dir}/WEB-INF/config/hibernate.cfg.xml" propertyfile="${web.dir}/WEB-INF/config/hibernate.properties"/>
<hbm2ddl export="false" drop="false" create="true" outputfilename="sms-schema.sql" haltonerror="true" />
</hibernatetool>
</target>

</project>

WEB-INF/lib contains (could there be a conflict?):
total 37592
6148 Jan 16 14:04 .DS_Store
54829 Oct 5 14:27 activation_1.0.2.jar
1034049 Aug 13 2005 ant-1.6.5.jar
5667 Aug 13 2005 ant-antlr-1.6.5.jar
74237 Aug 13 2005 ant-junit-1.6.5.jar
9180 Aug 13 2005 ant-launcher-1.6.5.jar
6763 Aug 13 2005 ant-swing-1.6.5.jar
443432 May 5 2006 antlr-2.7.6.jar
444689 Oct 5 14:27 antlr-2.7.6rc1.jar
16777 Mar 17 2005 asm-attrs.jar
26360 Mar 17 2005 asm.jar
88320 Jan 9 10:07 bsh-2.0b1.jar
487360 Jul 16 2005 c3p0-0.9.0.jar
282338 Dec 2 2005 cglib-2.1.3.jar
188671 Oct 5 14:27 commons-beanutils.jar
175426 Jun 30 2004 commons-collections-2.1.1.jar
168446 Oct 5 14:27 commons-digester.jar
22379 Oct 5 14:27 commons-fileupload.jar
207723 Oct 5 14:27 commons-lang-2.1.jar
38015 Jul 4 2004 commons-logging-1.0.4.jar
84462 Oct 5 14:27 commons-validator.jar
171071 Jun 3 2004 concurrent-1.3.2.jar
17978 Jun 3 2004 connector.jar
313898 Aug 13 2005 dom4j-1.6.1.jar
208048 Nov 3 11:05 ehcache-1.2.3.jar
50626 Dec 8 10:25 ejb3-persistence.jar
789043 Jan 9 10:07 freemarker.jar
438832 Dec 8 10:25 hibernate-annotations.jar
109113 Jan 9 10:07 hibernate-entitymanager.jar
360525 Jan 9 10:07 hibernate-tools.jar
2198080 Nov 16 14:31 hibernate3.2.1.jar
104359 Jun 3 2004 jaas.jar
65425 Oct 5 14:27 jakarta-oro.jar
517527 Jan 9 10:07 jboss-cache.jar
583206 Jan 9 10:07 jboss-common.jar
591568 Jan 9 10:07 jboss-jmx.jar
223640 Jan 9 10:07 jboss-system.jar
6727 Jun 3 2004 jdbc2_0-stdext.jar
1611518 Jan 9 10:07 jgroups-2.2.8.jar
16630 Oct 5 14:27 jstl.jar
8812 Jun 3 2004 jta.jar
249028 Jan 9 10:07 jtidy-r8-20060801.jar
121070 Jun 3 2004 junit-3.8.1.jar
350627 Aug 13 2005 log4j-1.2.11.jar
403597 Dec 8 10:25 lucene-core-2.0.0.jar
355030 Oct 5 14:27 mail_1.3.3.jar
391434 Aug 25 15:25 mysql-connector-java-3.1.6-bin.jar
114308 Jan 19 2005 oscache-2.1.jar
475943 Jan 9 10:07 proxool-0.8.3.jar
94129 Oct 5 14:27 qFramework_3_1_6.jar
1932690 Oct 5 14:27 spring_1_2_8.jar
315292 Oct 5 14:27 standard.jar
549876 Oct 5 14:27 struts.jar
30602 Jan 9 10:07 swarmcache-1.0rc2.jar
361173 Oct 5 14:27 velocity-1.4.jar
1010806 Dec 19 2004 xerces-2.6.2.jar
123705 Jun 3 2004 xml-apis.jar



Output of ANT:
Buildfile: build.xml

generate-ddl:
[echo] Start generate-ddl
[echo] Running generate-ddl
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] 2007-01-16 14:41:15,943 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.2.1.GA
[hibernatetool] 2007-01-16 14:41:15,967 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.2.1
[hibernatetool] 2007-01-16 14:41:15,972 [main] INFO org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.dialect=org.hibernate.dialect.MySQL5Dialect, hibernate.show_sql=true, hibernate.bytecode.use_reflection_optimizer=false, hibernate.hbm2ddl.auto=create}
[hibernatetool] 2007-01-16 14:41:15,978 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib
[hibernatetool] 2007-01-16 14:41:15,986 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 2007-01-16 14:41:16,110 [main] INFO org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml
[hibernatetool] 2007-01-16 14:41:16,172 [main] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
[hibernatetool] 2007-01-16 14:41:16,173 [main] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
[hibernatetool] 2007-01-16 14:41:16,174 [main] DEBUG org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
[hibernatetool] 2007-01-16 14:41:16,245 [main] DEBUG org.hibernate.cfg.Configuration - dialect=org.hibernate.dialect.MySQL5Dialect
[hibernatetool] 2007-01-16 14:41:16,245 [main] DEBUG org.hibernate.cfg.Configuration - show_sql=true
[hibernatetool] 2007-01-16 14:41:16,246 [main] DEBUG org.hibernate.cfg.Configuration - hbm2ddl.auto=create
[hibernatetool] 2007-01-16 14:41:16,249 [main] DEBUG org.hibernate.cfg.Configuration - connection.driver_class=org.gjt.mm.mysql.Driver
[hibernatetool] 2007-01-16 14:41:16,250 [main] DEBUG org.hibernate.cfg.Configuration - conection.url=jdbc:mysql://localhost:3306/sms
[hibernatetool] 2007-01-16 14:41:16,250 [main] DEBUG org.hibernate.cfg.Configuration - conection.username=sms
[hibernatetool] 2007-01-16 14:41:16,250 [main] DEBUG org.hibernate.cfg.Configuration - connection.password=XXXX
[hibernatetool] 2007-01-16 14:41:16,250 [main] DEBUG org.hibernate.cfg.Configuration - connection.pool_size=1
[hibernatetool] 2007-01-16 14:41:16,250 [main] DEBUG org.hibernate.cfg.Configuration - connection.statement_cache.size=25
[hibernatetool] 2007-01-16 14:41:16,251 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - null<-org.dom4j.tree.DefaultAttribute@5ad7b2 [Attribute: name class value "com.sms.model.Entree"]
[hibernatetool] 2007-01-16 14:41:16,262 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - null<-org.dom4j.tree.DefaultAttribute@ec3adc [Attribute: name class value "com.sms.model.Wine"]
[hibernatetool] 2007-01-16 14:41:16,264 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
[hibernatetool] 2007-01-16 14:41:16,264 [main] DEBUG org.hibernate.cfg.Configuration - properties: {hibernate.connection.password=XXXX, connection.password=XXXX, show_sql=true, hibernate.show_sql=true, connection.statement_cache.size=25, connection.pool_size=1, conection.url=jdbc:mysql://localhost:3306/sms, hibernate.connection.statement_cache.size=25, hibernate.hbm2ddl.auto=create, hibernate.connection.pool_size=1, hibernate.conection.url=jdbc:mysql://localhost:3306/sms, hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, conection.username=sms, hbm2ddl.auto=create, hibernate.conection.username=sms, connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.dialect=org.hibernate.dialect.MySQL5Dialect, dialect=org.hibernate.dialect.MySQL5Dialect}
[hibernatetool] 2007-01-16 14:41:16,264 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Execute first pass mapping processing
[hibernatetool] 2007-01-16 14:41:16,363 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process hbm files
[hibernatetool] 2007-01-16 14:41:16,363 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process annotated classes
[hibernatetool] 2007-01-16 14:41:16,363 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - processing manytoone fk mappings
[hibernatetool] 2007-01-16 14:41:16,364 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
[hibernatetool] 2007-01-16 14:41:16,365 [main] DEBUG org.hibernate.cfg.Configuration - processing collection mappings
[hibernatetool] 2007-01-16 14:41:16,365 [main] DEBUG org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
[hibernatetool] 2007-01-16 14:41:16,365 [main] DEBUG org.hibernate.cfg.Configuration - processing association property references
[hibernatetool] 2007-01-16 14:41:16,365 [main] DEBUG org.hibernate.cfg.Configuration - processing foreign key constraints
[hibernatetool] 2007-01-16 14:41:16,389 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQL5Dialect
[hibernatetool] 2007-01-16 14:41:16,464 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Execute first pass mapping processing
[hibernatetool] 2007-01-16 14:41:16,464 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process hbm files
[hibernatetool] 2007-01-16 14:41:16,465 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process annotated classes
[hibernatetool] 2007-01-16 14:41:16,465 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - processing manytoone fk mappings
[hibernatetool] 2007-01-16 14:41:16,465 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
[hibernatetool] 2007-01-16 14:41:16,466 [main] DEBUG org.hibernate.cfg.Configuration - processing collection mappings
[hibernatetool] 2007-01-16 14:41:16,467 [main] DEBUG org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
[hibernatetool] 2007-01-16 14:41:16,468 [main] DEBUG org.hibernate.cfg.Configuration - processing association property references
[hibernatetool] 2007-01-16 14:41:16,468 [main] DEBUG org.hibernate.cfg.Configuration - processing foreign key constraints
[hibernatetool] 2007-01-16 14:41:16,470 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Execute first pass mapping processing
[hibernatetool] 2007-01-16 14:41:16,471 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process hbm files
[hibernatetool] 2007-01-16 14:41:16,471 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - Process annotated classes
[hibernatetool] 2007-01-16 14:41:16,471 [main] DEBUG org.hibernate.cfg.AnnotationConfiguration - processing manytoone fk mappings
[hibernatetool] 2007-01-16 14:41:16,472 [main] DEBUG org.hibernate.cfg.Configuration - processing extends queue
[hibernatetool] 2007-01-16 14:41:16,472 [main] DEBUG org.hibernate.cfg.Configuration - processing collection mappings
[hibernatetool] 2007-01-16 14:41:16,472 [main] DEBUG org.hibernate.cfg.Configuration - processing native query and ResultSetMapping mappings
[hibernatetool] 2007-01-16 14:41:16,472 [main] DEBUG org.hibernate.cfg.Configuration - processing association property references
[hibernatetool] 2007-01-16 14:41:16,473 [main] DEBUG org.hibernate.cfg.Configuration - processing foreign key constraints
[hibernatetool] 2007-01-16 14:41:16,473 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
[hibernatetool] 2007-01-16 14:41:16,480 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaExport - import file not found: /import.sql
[hibernatetool] 2007-01-16 14:41:16,480 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - writing generated schema to file: /Users/jkapla/work/depot//SMSMarketingEngine/1.0/dev/db/generated/sms-schema.sql
[hibernatetool] 2007-01-16 14:41:16,481 [main] INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete

BUILD SUCCESSFUL
Total time: 1 second


Name and version of the database you are using: MySQL 5.0

Entree.java
package com.sms.model;
@Entity
@Table (name="entree")
public class Entree implements Serializable {

private Long id;
private String name;
private String status;
private String lastResponse;

@Id
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@Column (length=200)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Column (length=30)
public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

@Column (length=200)
public String getLastResponse() {
return lastResponse;
}

public void setLastResponse(String lastResponse) {
this.lastResponse = lastResponse;
}
}


Wine.java
package com.sms.model;
@Entity
@Table (name="wine")
public class Wine implements Serializable {

private Long id;
private String name;
private String type;

@Id
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}


@Column(length=100)
public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}


@Column(length=200)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 5:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
report in jira with the files attached needed to reproduce it and i'll look into it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 1:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
p.s. are you sure the classes are even picked up ? your log output looks like its just resulting in an empty configuration.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 3:21 pm 
Newbie

Joined: Wed Sep 29, 2004 8:06 pm
Posts: 4
Ok got it to work now.
(sort of bypassed it)

I seemed to have an issue with just having
@Entity
just would not work as if it needed
@Entity (access = AccessType.PROPERTY)
(which I thought was the default to begin with)
problem with that is it couldn't seem to find AccessType at all.
(is that javax.xml.bind ? I added JAXB and j2ee.jar and still could not find
javax.xml.bind.

SO I changed to use the hibernate AccessType annotation instead.

@Entity
@AccessType("property")
@Table (name="entree")
public class Entree implements Serializable {

That now works so that is KEWL.

Not sure why the other way would not and most of all why it would not log any issue/error at all.
Hmm.
Any idea?

Cheers


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 4:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well most likely you have been using just org.hibernate.annotation.Entity which is just something that *adds* to javax.persistence.Entity annotations.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 5:09 pm 
Newbie

Joined: Wed Sep 29, 2004 8:06 pm
Posts: 4
I see.

Thanx for the fast response(s).


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