I'm having problems of kind "you may not dereference a collection with cascade=all-delete-orphan". I've read something about, but my issue is a little different. It occurs when I try retrieving some objects from db, and it occurs randomly with a few queries. When I do a simple search, the exception occurs, if I try the search right after, the result come normally. Remenbering, I am just doing a simple search, not trying change the collection.
Hibernate 2.1.4
Mapping
Code:
...
<bag
name="garantias"
lazy="true"
cascade="all-delete-orphan"
>
<key
column="id_equipamento"
>
</key>
<one-to-many
class="br.com.inovar.gif.dominio.GarantiasFornecedor"
/>
</bag>
<list
name="itens"
table="equipamentos_item"
lazy="true"
cascade="none"
>
<key
column="id_equipamento"
>
</key>
<index
column="ordem"
/>
<many-to-many
class="br.com.inovar.gif.dominio.Item"
column="id_item"
outer-join="auto"
/>
</list>
<set
name="valoresCaracteristicos"
lazy="true"
cascade="all-delete-orphan"
sort="unsorted"
>
<key
column="id_equipamento"
>
</key>
<one-to-many
class="br.com.inovar.gif.dominio.ValorCaracteristico"
/>
</set>
<bag
name="locacao"
lazy="true"
cascade="all-delete-orphan"
>
<key
column="id_equipamento"
>
</key>
<one-to-many
class="br.com.inovar.gif.dominio.Locacao"
/>
</bag>
<bag
name="slots"
lazy="true"
cascade="all"
>
<key
column="id_equipamento"
>
</key>
<one-to-many
class="br.com.inovar.gif.dominio.Slot"
/>
</bag>
...
StacktraceCode:
2005-11-23 18:23:25,277 ERROR [org.jboss.web.localhost.Engine] StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
br.com.inovar.gif.persistencia.PersistenciaException: net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
at br.com.inovar.gif.persistencia.hibernate.HibernateEquipamentoDAO.busqueEquipamentosInfo(HibernateEquipamentoDAO.java:426)
at br.com.inovar.gif.dominio.facade.FacadeEquipamento.busqueEquipamentos(FacadeEquipamento.java:165)
at br.com.inovar.gif.controle.SelecaoDeEquipamentosAction.pesquisaEquipamentosCarrinho(SelecaoDeEquipamentosAction.java:209)
at sun.reflect.GeneratedMethodAccessor323.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at br.com.inovar.gif.controle.filtros.AutenticacaoFilter.doFilter(AutenticacaoFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at br.com.inovar.gif.controle.filtros.GerenciadorDeRecursosFilter.doFilter(GerenciadorDeRecursosFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
at net.sf.hibernate.impl.SessionImpl.updateUnreachableCollection(SessionImpl.java:2915)
at net.sf.hibernate.impl.SessionImpl.flushCollections(SessionImpl.java:2784)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2257)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1801)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1520)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
at br.com.inovar.gif.persistencia.hibernate.HibernateEquipamentoDAO.busqueEquipamentosInfo(HibernateEquipamentoDAO.java:423)
... 49 more
Database: Oracle 9