-->
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: hbm2ddl didn't generate ddl script and table
PostPosted: Wed Jun 06, 2007 2:26 pm 
Newbie

Joined: Wed Jun 06, 2007 2:08 pm
Posts: 2
I am using hbm2ddl to generate ddl script from a annotated pojo class. The class name is PolicyImpl. When I ran my ant script, it doesn't generate the ddl script. Then I changed the class name to NsaPolicyImpl and script as well as database table was created. It happened for class name Person, Driver. It's really freaking me out. I am using hibernate 3.2, hibernate-annotations-3.3.0.GA and hibernate-tools jar from HibernateTools-3.2.0.beta9a.

Here is my pojo class

import javax.persistence.*;
@Entity
@Table(name="NSA_POLICY")
public class PolicyImpl {

private String id;
private String address;
public PolicyImpl() { }

public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}

@Id @GeneratedValue
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}

}

And here is my the build script

<?xml version="1.0" encoding="UTF-8"?>

<project name="nsadomainddl" default="schemaexport" basedir="." >

<property name="src.java.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="bin"/>

<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
<pathelement location="bin/" />
<pathelement location="C:/oracle/product/10.1.0/Db_1/jdbc/lib/ojdbc14.jar" />
</path>

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" >
<classpath refid="classpath"/>
<classpath path="${build.dir}" />
</taskdef>

<target name="schemaexport" description="Export a generated schema to DB and a file">

<hibernatetool destdir="${basedir}">

<annotationconfiguration configurationfile="${build.dir}/hibernate.cfg.xml"/>

<hbm2ddl
drop= "true"
create= "true"
export= "true"
outputfilename="nsadomain-ddl.sql"
delimiter=";"
format="true"/>

</hibernatetool>

</target>

</project>

I am wondering if hibernate tool.jar has a bug. Any help will be really appreciated.

Thanks
Pranab


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 6:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hibernate tools just "dump" whatever hibernate core/annotations are telling is the classes/tables.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 11:42 am 
Newbie

Joined: Wed Jun 06, 2007 2:08 pm
Posts: 2
Thanks max. I figured out this problem. My codebase has a hidden reference to an external jar which has the similar set of classes. So hibernate was not letting me dump sql ddl for the class which exist in classpath.


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.