Open
Description
I have Contact
Entity and MailingAddress
Entity. Contact has a bag of MailingAddresses which is cached inside Redis but when a MailingAddress is deleted, the association bag of MailingAddress inside Redis is not updated so when we try to load the contact again we are getting an exception
NHibernate.ObjectNotFoundException: No row with the given identifier exists[Entity.MailingAddress#14448]
Here is the definition of entities:
<class name="MailingAddress" table="MailingAddress">
<cache include="all" usage="read-write" region="community" />
<id name="ID" type="System.Int64" column="ID">
<generator class="identity" />
</id>
<property name="Address1" column="Address1" />
<property name="StreetName" column="StreetName" />
<property name="Obsolete" column="Obsolete" />
<many-to-one name="Contact" cascade="none" lazy="proxy" fetch="select" class="Entity.Contact" column="ContactID" />
</class>
<class name="Contact" table="Contacts" discriminator-value="0">
<cache include="all" usage="read-write" region="community" />
<id name="ID" type="System.Int64" column="ID">
<generator class="identity" />
</id>
<discriminator column="ContactType" type="int" insert="false"/>
<property name="ContactType" column="ContactType" />
<property name="DisplayName" column="DisplayName" />
<property name="GID" column="GID" />
<property name="Obsolete" column="Obsolete" />
<bag name="Addresses" inverse="true" cascade="all-delete-orphan" fetch="select" lazy="true">
<cache include="all" usage="read-write" region="community" />
<key column="ContactID" />
<one-to-many class="Entity.MailingAddress" />
</bag>
</class>
If I update MailingAddress record then if I refresh Contact view then I get the updated value and I also see the key value updated. The issue happens if I delete MailingAddress then Contact.Addresses
key inside Redis is not removing the deleted MailingAddress and then I am getting.
Everything is done inside transactions.
Metadata
Metadata
Assignees
Labels
No labels