Discussion:
[Middlegen-user] customise hibernate association name
James Neville
2004-03-31 14:34:03 UTC
Permalink
Hi all,

Is there a way to rename the hibernate mapping relation names using the
middlegen-prefs.properties file?

I have an employee table with an FK of its employeeid - secretaryid.
I'd like to rename the many-to-one of employee to, say,
employeeBySecretaryId or similar.
Employee as a child of Employee is far too confusing in the the business
logic.;)

(see snippet below)

thanks,

James.


<snip>
<id
name="employeeid"
type="long"
column="employeeid"
<meta attribute="field-description">
@hibernate.id
generator-class="sequence"
type="long"
column="employeeid"

@hibernate.generator-param
name="sequence"
value="seq_employee_id"
</meta>
<generator class="sequence">
<param name="sequence">seq_employee_id</param>
</generator>
</id>
<snip>


<!-- bi-directional many-to-one association to Employee -->
<many-to-one
name="employee"
class="com.babcockbrown.hibernate.vo.Employee"
not-null="true"
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="secretaryid"
</meta>
<column name="secretaryid" />
</many-to-one>
<snip>

Loading...