[hibernate-issues] [JIRA] (HHH-14058) Second level cache missing entity after delete child with foreign key on delete set null

Alex CD (JIRA) jira at hibernate.atlassian.net
Wed Jun 3 12:55:48 EDT 2020


Alex CD ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A9b0f6d49-bc76-4aca-875b-c8525b2f039d ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14058?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 ) HHH-14058 ( https://hibernate.atlassian.net/browse/HHH-14058?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 ) Second level cache missing entity after delete child with foreign key on delete set null ( https://hibernate.atlassian.net/browse/HHH-14058?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.15 Assignee: Unassigned Created: 03/Jun/2020 09:55 AM Priority: Major Reporter: Alex CD ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A9b0f6d49-bc76-4aca-875b-c8525b2f039d )

*Person* entity references one *Nickname* entity having foreign key *on delete set null*.

If Person _entity is stored in second level cache and her _Nickname entity is deleted by a native query, then the reference id is set to null in database, but the cached Person entity still has the old reference id.

Loading the Person from second level cache (entitymanager.find) tries to load the old Nickname that doesn't exist, throws EntityNotFoundException that cascades and ultimately returns a *null Person* object.

Person entity still *exists* in database and should have been found and the invalid reference should be resolved somehow (maybe recheck in database).

( https://hibernate.atlassian.net/browse/HHH-14058#add-comment?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14058#add-comment?atlOrigin=eyJpIjoiMjczMjI2ZDlhNTczNDFiNjhhYzA0OTFmOWNjODQ1MjgiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100128- sha1:03ebdb2 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200603/672a4663/attachment.html 


More information about the hibernate-issues mailing list