Beginner |
|
Joined: Tue Oct 28, 2008 6:41 pm Posts: 20
|
Hi ,
The 'create hibernate mapping file' tool in Eclipse is not working as intended .
When I try to create a hibernate mapping file from a pojo using the hibernate mapping file tool in eclipse ,it just generates a standard xml header and doesn't create any mappings at all.
In the dialogue I point to the entitys.Person.java file as the class to create. This is the automatic default as I have highlighted the source class prior to running the tool .
here is the pojo :
package entitys;
public class Person {
int id;
String firstName;
String lastName ;
String hometown;
Integer weight;
java.util.Date dob ;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getHometown() {
return hometown;
}
public void setHometown(String hometown) {
this.hometown = hometown;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public java.util.Date getDob() {
return dob;
}
public void setDob(java.util.Date dob) {
this.dob = dob;
}
}
---here is what gets produced
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="entitys">
<class name="Person">
</class>
</hibernate-mapping>
--here is the configuration file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/football</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">tiger</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="entitys/Person.hbm.xml"/>
<mapping resource="entitys/Position.hbm.xml"/>
<mapping resource="entitys/Team.hbm.xml"/>
</session-factory>
</hibernate-configuration>
If anybody has any idea of why this doesn't work please let me know.
thanks.
|
|