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