Hi all,
In the mapping file, if my entity bean defines a component with a <parent> tag to wire up a backward reference, is there a way to specify the access type of that reference to be "field" rather than "property"? For example,
mapping:
Code:
<class name="Cat" table="cat">
...
(some properties)
...
<component name="assistant" class="AssistantCat" access="field">
<parent name="boss" />
...
(some properties)
...
</component>
</class>
entity classes:
Code:
public class Cat{
private Assistantcat assistant;
...
(other fields)
...
private Cat(){}
...
}
public class AssistantCat{
private Cat boss;
...
(other fields)
...
private AssistantCat(){}
...
}
In this case I have to add a setter for boss to make the mapping work. Is there any way to avoid this?
In addition, if I set the default access type as field like the following, hibernate still tries to access "boss" by property.
Code:
<hibernate-mapping default-access="field">
...
</hibernate-mapping>
Thanks.