-->
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.  [ 4 posts ] 
Author Message
 Post subject: HSEARH]AssertionFailure: collection not processed by flush()
PostPosted: Fri Jan 25, 2008 2:39 am 
Newbie

Joined: Tue Nov 13, 2007 1:09 pm
Posts: 7
org.hibernate.AssertionFailure: collection was not processed by flush()
the above exception is occuring when ever iam trying to update a indexed entity in Hibernate Search.
Iam trying to resolve this error for the past one day but i couldnot.


Exception details
======================
ERROR org.hibernate.AssertionFailure -an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: collection [com.abc.domain.B.cset] was not processed by flush()
at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor.postHandle(OpenSessionInViewInterceptor.java:174)
at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.postHandle(WebRequestHandlerInterceptorAdapter.java:61)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:863)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.httpfuse.filter.SessionFilter.doFilter(SessionFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)


===============================================================================================================================



Observations
================
@Indexed
class A
{
.......
@IndexedEmbedded
private Set<B> bset = new HashSet<B>();
}
-----
class B
{
.......
@ContainedIn
private A a;

private Set<C> cset = new HashSet<C> ();//this another non indexed collection which is present in B

}


1) the above exception is occuring when ever iam updating an object of type Class A (which is indexed).
2) If i remove @IndexedEmbedded on the collection then the issue is not occuring.
---------
org.hibernate.AssertionFailure: collection [com.abc.domain.B.cset] was not processed by flush()
3) The above error shows that the AssertionFailure is occuring when hibernate is trying to load Entity B cset collection
which is not part of the index at all.
4) I guess some unusual thing is going on when ever we are trying to update an entity which has @IndexedEmbedded on a collection.

can any one please guide my in resolving the above issue?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 12:29 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The error probably comes from somewhere and HSearch emphasize it.
Can you write down a minimal unit test that reproduces this issue (please not with spring in between).

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 27, 2008 12:23 pm 
Newbie

Joined: Tue Feb 21, 2006 12:22 pm
Posts: 16
The problem is that AbstractFlushingEventListener.performExecutions() can result in new CollectionEntrys being created (because listeners access lazy collections, etc...). These CollectionEntry objects are technically created during a flush but not when the PersistenceConext.flushing attribute is set.

I looks safe to update AbstractFlushingEventListener.performExecutions() to:

session.getPersistenceContext().setFlushing(true);
try {
session.getJDBCContext().getConnectionManager().flushBeginning();
// we need to lock the collection caches before
// executing entity inserts/updates in order to
// account for bidi associations
session.getActionQueue().prepareActions();
session.getActionQueue().executeActions();
}
catch (HibernateException he) {
log.error("Could not synchronize database state with session", he);
throw he;
}
finally {
session.getPersistenceContext().setFlushing(false);
session.getJDBCContext().getConnectionManager().flushEnding();
}

That should get rid of this issue, but I am have not analyzed everything that occurs in session.getActionQueue().executeActions() so there could be some side affect, but since the 'flushing' attribute is really only used for CollectionEntry objects, it seems safe.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 5:55 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
A test case would be cool (and essential)
I have created the Jira issue
http://opensource.atlassian.com/project ... SEARCH-178

_________________
Emmanuel


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

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.