The following config is in my code that runs in production. I would like to use Second Level Cache on entity B and I generally run a query on entity A. My problem is, that B entities are not in the the cache, and Hibernate always runs a second select, that queries B from the database.
It is possible to force Hibernate to use the cache?
A -- M2O --> B
<class name="A" table="A"> <many-to-one name="nameOfTheField" property-ref="complexProps"> <column name="stringCodeOfB" /> <formula>1</formula> </many-to-one> </class>
<class name="B" table="B"> <properties name="complexProps"> <property name="stringCode" column="stringCode" /> <property name="status" column="status" /> </properties> </class>
|