[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2305) refresh throws exception when database has been altered with a delete

Kai Prünte (JIRA) noreply at atlassian.com
Fri Jun 15 08:55:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27265 ] 

Kai Prünte commented on HHH-2305:
---------------------------------

I have the same problem. If I understand the DefaultRefreshEventListener correct, the line:

new Cascade(CascadingAction.REFRESH, Cascade.BEFORE_REFRESH, source).cascade( persister, object, refreshedAlready );

is responsible for refreshing the collections or others associations with the right cascade style. Some lines below the object itself will be refreshed by this line:

Object result = persister.load( id, object, event.getLockMode(), source );

In my opinion the object must be first reloaded and then the refresh must be cascaded to the associations. But perhaps there is a good reason for that sequence?

> refresh throws exception when database has been altered with a delete
> ---------------------------------------------------------------------
>
>                 Key: HHH-2305
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2305
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.1
>         Environment: Hibernate 3.2.1, Oracle 9.2
>            Reporter: Markus Heiden
>         Attachments: hibernate.zip
>
>
> First I save an entity with a collection of cascading entities in it and flush. Then I delete these cascaded entities with a sql query. When I now do a refresh on the entity an exception is thrown, because the cascaded entities couldn't be found in the database. I expected these entities to be deleted from the (in memory) collection of the entity instead.
> Test case is attached. Stacktrace of test case:
> Hibernate: select c0_.id as id2_0_, c0_.c as c2_0_ from C c0_ where c0_.id=?
> org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [hibernate.refresh.C#30003]
> 	at org.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:42)
> 	at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:126)
> 	at org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:911)
> 	at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:894)
> 	at org.hibernate.engine.CascadingAction$4.cascade(CascadingAction.java:169)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
> 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:99)
> 	at org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:911)
> 	at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:894)
> 	at org.hibernate.engine.CascadingAction$4.cascade(CascadingAction.java:169)
> 	at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
> 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
> 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
> 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> 	at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:99)
> 	at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:39)
> 	at org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:902)
> 	at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:886)
> 	at hibernate.refresh.Test.main(Test.java:46)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the hibernate-issues mailing list