-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem with cascading refresh on object with collections
PostPosted: Thu Sep 07, 2006 9:41 am 
Newbie

Joined: Tue Feb 21, 2006 3:37 am
Posts: 2
I have a problem with cascading refresh on persistent objects with collections.

I am working with:
Hibernate version:3.1

I have an Object named Action and this object has a set with FunctionalAssociations in it.
Mapping documents:
<hibernate-mapping>
<class table="ACT" name="com.bpl.popo.Action">
<id name="actionId" type="java.lang.Long" column="ACT_ID" length="15">
<generator class="com.bpl.IdGenerator">
<param name="sequence">act_id_seq</param>
<param name="MyIdType">Prefix</param>
</generator>
</id>

<set name="actionFunctionalAssociations" inverse="true" cascade="all-delete-orphan" >
<key column ="SUBJ_ACT_ID" />
<one-to-many
class="com.bpl.popo.ActionFunctionalAssociation" />
</set>


In my application i need to have the possibility to work on more than one client, but each client is working on the same database on one server. Also each client has its own thread, i.e. also different sessions. I am working with database-notification to inform the other client about changes made in the first client. When a change is made, a trigger runs and make some inserts in a notification-table. Each application looks with polling in this table, and makes changes if necessary. This works fine while i am working with inserts or updates.

Now my Problem: when i remove a functionalAssociation from an Action on one client, the other client gets the notification of the change, and tries to refresh the action. But during refreshing this action it cascades also the collections inside the action, and tries then to refresh the deleted functionalAssociation also, so i get following exception. (But i need the cascade property to be sure that all functionalAssociations are deleted if the Action is deleted, so i can't work with no cascading.)

Full stack trace of any exception that occurs:
org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [com.bpl.popo.ActionFunctionalAssociation#110100000006]
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:895)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:878)
at org.hibernate.engine.CascadingAction$4.cascade(CascadingAction.java:92)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:290)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:185)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:160)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
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:886)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:870)
at org.jdbcluster.template.hibernate.HibernateSession.refresh(HibernateSession.java:227)
at com.cc.ClusterContainerImpl.dbRevert(ClusterContainerImpl.java:198)
at com.cc.ClusterContainerImpl.clusterNotification(ClusterContainerImpl.java:264)
at com.notification.ClusterContainerLocalNotification.notifyClusterContainer(ClusterContainerLocalNotification.java:72)
at com.notification.NotificationClient$1.run(NotificationClient.java:91)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


I am working with the DB:
Name and version of the database you are using:Oracle 9.2i


Debug level Hibernate log excerpt:
88000 DEBUG [AWT-EventQueue-0] org.hibernate.engine.Cascade cascade ACTION_REFRESH for collection: com.bpl.popo.Action.actionFunctionalAssociations
88000 DEBUG [AWT-EventQueue-0] org.hibernate.engine.CascadingAction cascading to refresh: com.bpl.popo.ActionFunctionalAssociation
88000 DEBUG [AWT-EventQueue-0] org.hibernate.event.def.DefaultRefreshEventListener refreshing [com.bpl.popo.ActionFunctionalAssociation#110100000006]
88000 DEBUG [AWT-EventQueue-0] org.hibernate.persister.entity.AbstractEntityPersister Fetching entity: [com.bpl.popo.ActionFunctionalAssociation#110100000006]
88000 DEBUG [AWT-EventQueue-0] org.hibernate.loader.Loader loading entity: [com.bpl.popo.ActionFunctionalAssociation#110100000006]
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.ConnectionManager opening JDBC connection
88000 DEBUG [AWT-EventQueue-0] org.hibernate.connection.DriverManagerConnectionProvider total checked-out connections: 0
88000 DEBUG [AWT-EventQueue-0] org.hibernate.connection.DriverManagerConnectionProvider using pooled JDBC connection, pool size: 0
88000 DEBUG [AWT-EventQueue-0] org.hibernate.SQL
select
actionfunc0_.ACT_FUNCTL_ASSOC_IX as ACT1_51_0_,
actionfunc0_.CAT_CODE as CAT2_51_0_,
actionfunc0_.SUBJ_ACT_ID as SUBJ3_51_0_,
actionfunc0_.OBJ_ACT_ID as OBJ4_51_0_,
actionfunc0_.UPDATE_SEQNR as UPDATE5_51_0_,
actionfunc0_.OWNER_ID as OWNER6_51_0_
from
ACT_FUNCTL_ASSOC actionfunc0_
where
actionfunc0_.ACT_FUNCTL_ASSOC_IX=?
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher preparing statement
88000 DEBUG [AWT-EventQueue-0] org.hibernate.type.LongType binding '110100000006' to parameter: 1
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher about to open ResultSet (open ResultSets: 0, globally: 0)
88000 DEBUG [AWT-EventQueue-0] org.hibernate.loader.Loader processing result set
88000 DEBUG [AWT-EventQueue-0] org.hibernate.loader.Loader done processing result set (0 rows)
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher about to close ResultSet (open ResultSets: 1, globally: 1)
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
88000 DEBUG [AWT-EventQueue-0] org.hibernate.jdbc.AbstractBatcher closing statement
88000 DEBUG [AWT-EventQueue-0] org.hibernate.loader.Loader total objects hydrated: 0
88000 DEBUG [AWT-EventQueue-0] org.hibernate.engine.StatefulPersistenceContext initializing non-lazy collections
88000 DEBUG [AWT-EventQueue-0] org.hibernate.loader.Loader done entity load
88000 ERROR [AWT-EventQueue-0] com.bean.swing.AWTExceptionHandler Error in AWT
org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [com.bpl.popo.ActionFunctionalAssociation#110100000006]


Hope that someone can help me with that problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.