Hi to all
I am trying Hibernate many-to-one association for foreign key relation for two tables.but i am getting the following error
org.hibernate.MappingException: An association from the table contact_bh refers to an unmapped class: Contact_rvBean
can any one solve this
My code--
First table: contact_rv
PID NOT NULL NUMBER(38)
PNAME VARCHAR2(50)
Second table: contact_bh
EMPID NOT NULL NUMBER(38)
PID NUMBER(38)
I want to have foreign key relation for pid in contact_bh to pid in contact_rv
My mapping files are--
For contact_rv
-----------------------------------------------
<?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.mss.Contact_rvBean" table="contact_rv">
<id name="pid" type="int" column="pid">
<generator class="increment"/>
</id>
<property name="pname" column="pname" />
</class>
</hibernate-mapping>
For contact_bh
<?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.mss.Contact_bhBean" table="contact_bh">
<id name="empid" type="int" column="empid">
<generator class="increment"/>
</id>
<many-to-one name="pid" class="Contact_rvBean" column="pid"/>
</class>
</hibernate-mapping>
beans are
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.mss;
/**
*
* @author miracle
*/
public class Contact_bhBean {
private int empid;
private int pid;
private Contact_rvBean rvbean;
public int getEmpid() {
return empid;
}
public void setEmpid(int empid) {
this.empid = empid;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public Contact_rvBean getRvbean() {
return rvbean;
}
public void setRvbean(Contact_rvBean rvbean) {
this.rvbean = rvbean;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.mss;
/**
*
* @author miracle
*/
public class Contact_rvBean {
private int pid;
private String pname;
public
int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
}
Can any one PLz PLz PLz PLzPLzPLzPLz PLzPLz................Help me to come out of this problem
or
Please give complete code for one mapping example.
thanks in advance
raghu
|