Hi
Employee
EmpId
EmpName
EmpTitle
Position
PositionId
PositionName
This is not exactly what you want. but your table structure might like this. Here EmpTitle foreign key is PositionId. With that link you can find position name. Don't use description type fields to foreignkey constrains.
hibernate mapping files may look like this.
Employee.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="test.Employee"
table="Employee"
>
<id
name="EmpId"
column="EmpId"
type="java.lang.Long"
>
<generator class="assigned">
</generator>
</id>
<many-to-one
name="tool"
class="test.Position"
cascade="none"
update="true"
insert="true"
lazy="false"
column="EmpTitle"
/>
<property
name="EmpName"
type="java.lang.String"
update="true"
insert="true"
column="EmpName"
/>
</class>
</hibernate-mapping>
Position.hbm.xmlCode:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="test.Position"
table="Position"
>
<id
name="PositionId"
column="PositionId"
type="java.lang.Long"
>
<generator class="assigned">
</generator>
</id>
<property
name="PositionName"
type="java.lang.String"
update="true"
insert="true"
column="PositionName"
/>
</class>
</hibernate-mapping>
Amila
(Don't forget to rate if helps)