I'm doing a tutorial which uses spring + Hibernate Annotations ... I use log4j.properties to help me see the loggers. I get a ERROR log which states "Unsuccessful: create table myobject(...)" Error location being "org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:325)"
Qs.
1. I noticed on the tutorial, there's no where a table is created on the DB, so i assume hibernate does this by using hbm2ddl.. Where is this located and where does one normally tell hibernate to invoke this function
2. I also have a DEBUG logger "import file not found: /import.sql" also pointing to the same location ... Am really lost as to where these configurations are done on my application
here's my hibernate.cfg.xml
Code:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<mapping class="org.annotationmvc.vo.MyObjectVO"/>
</session-factory>
</hibernate-configuration>
and here's my POJO
Code:
package org.annotationmvc.vo;
import java.io.*;
import javax.persistence.*;
@Entity
@Table (name="myobject")
public class MyObjectVO implements Serializable {
private int id;
private String name;
private String address;
private String email;
private String phone;
public MyObjectVO() {
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setAddress(String address) {
this.address = address;
}
public void setEmail(String email) {
this.email = email;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
//@Id (generate = GeneratorType.AUTO)
public int getId() {
return id;
}
@Column (length=100)
public String getName() {
return name;
}
@Column (length=100)
public String getAddress() {
return address;
}
@Column (length=30)
public String getEmail() {
return email;
}
@Column (length=15)
public String getPhone() {
return phone;
}
}
I'm sure this line "@Table (name="myobject")" expects the table to exist already, but where exactly is/should the creation of the table be?