Formula and <many-to-one> relationships are two diferrent things. Please specify the table strcutures that you are trying to retrieve and we can help further.
Here's a simple example of bi-directional many-to-one:
Code:
<?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="com.test.hibernate.model">
<class name="Employee" table="EMPLOYEE">
<id name="employeeId" column="EMPLOYEE_ID" unsaved-value="-1">
<generator class="increment"/>
</id>
<property name="firstName" column="FIRST_NAME"
not-null="true"
length="20"
/>
<property name="lastName" column="LAST_NAME"
length="20"
/>
<property name="address1" column="ADDRESS_1"
length="20"
/>
<property name="address2" column="ADDRESS_2"
length="20"
/>
<property name="zipCode" column="ZIP_CODE"
length="20"
/>
<property name="fullName" formula="FIRST_NAME||LAST_NAME"
length="20"
/>
<set name="empHistory" cascade="all" >
<key column="EMPLOYEE_ID"/>
<one-to-many class="EmployeeHistory" inverse="true"/>
</set>
</class>
</hibernate-mapping>
Code:
<?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="com.test.hibernate.model">
<class name="EmployeeHistory" table="EMPLOYEE_HISTORY">
<id name="eventId" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="dateOccurred" column="OCCURRED_DT" not-null="true" />
<property name="eventType" column="EVENT_TYPE"/>
<property name="comments" column="COMMENTS"/>
<many-to-one name="employee" />
</class>
</hibernate-mapping>
[/code]