nagag124 wrote:
Problems with second level cache (EH),
Newly created child object is not added to parent's (which is in second level cache)
collection of child objects.
[...]
Relevant portions of LevelMeataDataType.hbm.xml Code:
<class name="LevelMetaDataType" table="levelMetaDataTypes" dynamic-update="true">
.................
<many-to-one name="levelType" column="levelTypeId" lazy="proxy" fetch="select"/>
</class>
I had a problem very very similar to yours. My guess is that it's a bug in Hibernate. However, I did find a solution: adding
Code:
cascade="save-update, persist, merge"
to the many-to-one did the trick for me.
In your case that would be:
Code:
<class name="LevelMetaDataType" table="levelMetaDataTypes" dynamic-update="true">
.................
<many-to-one name="levelType" column="levelTypeId" lazy="proxy" cascade="save-update, persist, merge" fetch="select"/>
</class>