I am new to hibernate and trying to use hbm2java (using ant) for code generation from hbm.xml file...
i have simple tables Employee(id, name) and Applicant(id, REFERENCE_id, name).
REFERENCE_id in Applicant table is FK of id in Employee table. i wrote hbm.xml file for Employee as follows..
<?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>
<class name="com.gs.persistence.doObjects.EmployeeDO" table="CH_EMPLOYEE">
<id name="id" column="EMPLOYEE_ID" type="integer">
<generator class="increment"/>
</id>
<property name="empFirstName" column="EMPLOYEE_NAME" type="String" />
<set name="referredApplicants" table="CH_APPLICANTS">
<key column="REFERENCE_ID"/>
<one-to-many class="com.gs.persistence.doObjects.ApplicantDO"/>
</set>
</class>
</hibernate-mapping>
IS THIS A RIGHT DECLARATION? IF SO....
i am getting EmployeeDO as follows...
package com.gs.persistence.doObjects;
// Generated Nov 22, 2006 8:50:00 PM by Hibernate Tools 3.2.0.beta8
/**
* EmployeeDO generated by hbm2java
*/
public class EmployeeDO implements java.io.Serializable {
// Fields
private Integer id;
private String empFirstName;
// Constructors
/** default constructor */
public EmployeeDO() {
}
/** full constructor */
public EmployeeDO(String empFirstName) {
this.empFirstName = empFirstName;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEmpFirstName() {
return this.empFirstName;
}
public void setEmpFirstName(String empFirstName) {
this.empFirstName = empFirstName;
}
}
NO METHOD RELATED TO <set name="referredApplicants" ..... > got generated.
-------------------------
Hibernate VERSIONs are as follows..
Hibernate - hibernate-3.2
Hibernate Tools - HibernateTools-3.2.0.beta8.zip
|