posted 12 years ago
Thanks for the reply Rishi.I can ovverride the fetchmode on the properties directly defined on the entitiy I am querying on.But the problem here is because of the settings on a associated entity of the current entity.
I will try to explain with simple terms.
Two entities A and B.
<hibernate-mapping>
<class name="A" table="A" >
<many-to-one name="b" column="BUFI" class="Bi" entity-name="B" lazy="proxy"/>
</class>
</hibernate-mapping>
Definition of entity B that is associated to class A is below
<hibernate-mapping>
<class name="B" table="B" lazy="false" entity-name="B">
</class>
</hibernate-mapping>
associated property B is set to lazy="proxy" which is not taking effect as B is set to lazy="false" at the entity level.
Now when i am trying to load entity A, i can override fetchmode of it's own associtions which is any way set to lazy="proxy".I don't have any problem here.
The issue is cant override fetch mode of entity B,i.e set at its entity level.
Well, due to certain reasons which are part of business logic, we have to set lazy="false" for B at entity level.