[Teneo] session refresh throws UnresolvableObjectException: No row with the given identifier exists [message #1053742] |
Tue, 07 May 2013 09:07  |
Eclipse User |
|
|
|
Hi,
We're creating a RCP application and we use EMF resources to load our data. We're in need of calling an Oracle stored procedure to modify our data. After the procedure we want to refresh one single object, but that causes some problems.
This is our simplified model:
- Folder
-- documents : Document (opposite: folder)
- Document
-- folder : Folder (opposite: documents)
Our procedure deletes a document from the database so we want to refresh our folder. I expected the documents reference to update automatically, but instead it tries to load the deleted object. This is the error we get:
org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [Document#1161401]
at org.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:64)
at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:159)
at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1044)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1029)
at org.hibernate.engine.spi.CascadingAction$3.cascade(CascadingAction.java:205)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:380)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:323)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208)
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:409)
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:350)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:326)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:208)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:165)
at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:123)
at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:64)
at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1036)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1013)
at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1008)
This is the code we execute after the procedure:
On this forum I read the not-found="ignore" prevents the error from happening but I can't set this because I use the EOpposite...
Does anyone know how to solve this?
Thanks in advance!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: [Teneo] session refresh throws UnresolvableObjectException: No row with the given identifier exi [message #1057769 is a reply to message #1057687] |
Wed, 08 May 2013 11:57  |
Eclipse User |
|
|
|
Hi Ricky,
The best approach is to remove refresh from the cascade option (so set the CASCADE_POLICY_ON_NON_CONTAINMENT to only
PERSIST and MERGE).
Then refresh the objects you want to refresh explicitly, so if you refresh a parent then if also the children need to be
refreshed to do that explicitly for each one of them.
Or could it be that the object itself is already deleted? In that case I would catch the exception and remove the object
from the resource explicitly also.
gr. Martin
On 05/08/2013 09:39 AM, Ricky de Klerck wrote:
> Ok, but when I do need the refresh/merge I have to set the @NotFound in every reference below my Document? Otherwise it
> produces an error when refreshing after a Document is deleted
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|