-->
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.  [ 5 posts ] 
Author Message
 Post subject: Use of FetchType/FetchMode
PostPosted: Fri Nov 30, 2007 3:38 pm 
Newbie

Joined: Tue Nov 20, 2007 10:37 am
Posts: 4
Hibernate version:
3.2.5ga Hibernate Core
3.3.0ga Hibernate Annotation
Name and version of the database you are using:
Postgres 8.2.3

My Question:
I' have tested that using a mix of two annotation belowe:

fetch = FetchType.EAGER)
@Fetch (
value = FetchMode.SELECT
)

If I try to stand up more object in EAGER mode, with this combination of annotation hibernate not throws exceptions (exception for multiple bag fetching and the exception in full stack trace paragraph). My questions is:
-The mix of above annotations in hibernate is wrong or right?and which are the effects?
-Why hibernate allow me to fetch more eager object in this annotation configuration?

Code between sessionFactory.openSession() and session.close():
Use of declarative transaction management into spring

Full stack trace of any exception that occurs:

Note: this exception is throw only if I use only the @Fetch annotation with SELECT mode.



    2007-11-26 18:07:53,125 ERROR [org.hibernate.LazyInitializationException] - failed to lazily initialize a collection of role: it.project.intranet.progettazione.type.TipologiaProgetto.tipologiePubblAssoc, no session or session was closed
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: it.project.intranet.progettazione.type.TipologiaProgetto.tipologiePubblAssoc, no session or session was closed
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
    at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
    at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
    at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
    at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:554)
    at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:564)
    at org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:514)
    at org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:431)
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:122)
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:44)
    at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
    at it.project.intranet.service.ApplicationService$$EnhancerByCGLIB$$1fd3c5f3.saveOrUpdate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.binding.method.MethodInvoker.invoke(MethodInvoker.java:97)
    at org.springframework.webflow.action.AbstractBeanInvokingAction.doExecute(AbstractBeanInvokingAction.java:132)
    at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:203)
    at org.springframework.webflow.engine.AnnotatedAction.execute(AnnotatedAction.java:154)
    at org.springframework.webflow.engine.ActionExecutor.execute(ActionExecutor.java:61)
    at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:180)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.SubflowState.onEvent(SubflowState.java:151)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.EndState.doEnter(EndState.java:146)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.impl.FlowExecutionImpl.signalEvent(FlowExecutionImpl.java:217)
    at org.springframework.webflow.executor.FlowExecutorImpl.resume(FlowExecutorImpl.java:245)
    at org.springframework.webflow.executor.support.FlowRequestHandler.handleFlowRequest(FlowRequestHandler.java:115)
    at org.springframework.webflow.executor.mvc.FlowController.handleRequestInternal(FlowController.java:172)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
    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:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)


    2007-11-26 18:07:53,125 ERROR [org.hibernate.transaction.JDBCTransaction] - exception calling user Synchronization
    org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: it..project..intranet.progettazione.type.TipologiaProgetto.tipologiePubblAssoc, no session or session was closed
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
    at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
    at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
    at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
    at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:554)
    at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:564)
    at org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:514)
    at org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:431)
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:122)
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:44)
    at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
    at it..project..intranet.service.ApplicationService$$EnhancerByCGLIB$$1fd3c5f3.saveOrUpdate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.binding.method.MethodInvoker.invoke(MethodInvoker.java:97)
    at org.springframework.webflow.action.AbstractBeanInvokingAction.doExecute(AbstractBeanInvokingAction.java:132)
    at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:203)
    at org.springframework.webflow.engine.AnnotatedAction.execute(AnnotatedAction.java:154)
    at org.springframework.webflow.engine.ActionExecutor.execute(ActionExecutor.java:61)
    at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:180)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.SubflowState.onEvent(SubflowState.java:151)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.EndState.doEnter(EndState.java:146)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.impl.FlowExecutionImpl.signalEvent(FlowExecutionImpl.java:217)
    at org.springframework.webflow.executor.FlowExecutorImpl.resume(FlowExecutorImpl.java:245)
    at org.springframework.webflow.executor.support.FlowRequestHandler.handleFlowRequest(FlowRequestHandler.java:115)
    at org.springframework.webflow.executor.mvc.FlowController.handleRequestInternal(FlowController.java:172)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
    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:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)


    2007-11-26 18:07:53,140 ERROR [org.hibernate.annotations.common.AssertionFailure] - an assertion failure occured (this may indicate a bug in Hibernate)
    org.hibernate.annotations.common.AssertionFailure: Access a Sealed WorkQueue whcih has not been sealed
    at org.hibernate.search.backend.WorkQueue.getSealedQueue(WorkQueue.java:48)
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:130)
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:50)
    at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsAfterTransactionCompletion(JDBCTransaction.java:243)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:121)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
    at it..project..intranet.service.ApplicationService$$EnhancerByCGLIB$$1fd3c5f3.saveOrUpdate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.binding.method.MethodInvoker.invoke(MethodInvoker.java:97)
    at org.springframework.webflow.action.AbstractBeanInvokingAction.doExecute(AbstractBeanInvokingAction.java:132)
    at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:203)
    at org.springframework.webflow.engine.AnnotatedAction.execute(AnnotatedAction.java:154)
    at org.springframework.webflow.engine.ActionExecutor.execute(ActionExecutor.java:61)
    at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:180)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.SubflowState.onEvent(SubflowState.java:151)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.EndState.doEnter(EndState.java:146)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.impl.FlowExecutionImpl.signalEvent(FlowExecutionImpl.java:217)
    at org.springframework.webflow.executor.FlowExecutorImpl.resume(FlowExecutorImpl.java:245)
    at org.springframework.webflow.executor.support.FlowRequestHandler.handleFlowRequest(FlowRequestHandler.java:115)
    at org.springframework.webflow.executor.mvc.FlowController.handleRequestInternal(FlowController.java:172)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
    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:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)

    2007-11-26 18:07:53,140 ERROR [org.hibernate.transaction.JDBCTransaction] - exception calling user Synchronization
    org.hibernate.annotations.common.AssertionFailure: Access a Sealed WorkQueue whcih has not been sealed
    at org.hibernate.search.backend.WorkQueue.getSealedQueue(WorkQueue.java:48)
    at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:130)
    at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:50)
    at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsAfterTransactionCompletion(JDBCTransaction.java:243)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:121)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:578)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
    at it.project.intranet.service.ApplicationService$$EnhancerByCGLIB$$1fd3c5f3.saveOrUpdate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.binding.method.MethodInvoker.invoke(MethodInvoker.java:97)
    at org.springframework.webflow.action.AbstractBeanInvokingAction.doExecute(AbstractBeanInvokingAction.java:132)
    at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:203)
    at org.springframework.webflow.engine.AnnotatedAction.execute(AnnotatedAction.java:154)
    at org.springframework.webflow.engine.ActionExecutor.execute(ActionExecutor.java:61)
    at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:180)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.SubflowState.onEvent(SubflowState.java:151)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.EndState.doEnter(EndState.java:146)
    at org.springframework.webflow.engine.State.enter(State.java:200)
    at org.springframework.webflow.engine.Transition.execute(Transition.java:229)
    at org.springframework.webflow.engine.TransitionableState.onEvent(TransitionableState.java:112)
    at org.springframework.webflow.engine.Flow.onEvent(Flow.java:572)
    at org.springframework.webflow.engine.impl.RequestControlContextImpl.signalEvent(RequestControlContextImpl.java:208)
    at org.springframework.webflow.engine.impl.FlowExecutionImpl.signalEvent(FlowExecutionImpl.java:217)
    at org.springframework.webflow.executor.FlowExecutorImpl.resume(FlowExecutorImpl.java:245)
    at org.springframework.webflow.executor.support.FlowRequestHandler.handleFlowRequest(FlowRequestHandler.java:115)
    at org.springframework.webflow.executor.mvc.FlowController.handleRequestInternal(FlowController.java:172)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
    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:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)




    --------------------------------------------------------
    Caused by:
    org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
    at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:66)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:75)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:43)
    at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:33)
    at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:103)

    ---------------------------------------------------------

_________________
GURU JR_JAVARUDE..a new philosophy...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 30, 2007 10:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Because what is forbidden (and impossible) is loading more than one bag per SQL query. If you so it using different queries you're fine.

And yes the combination of annotations is valid but I would have used SUBSELECT I think

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 04, 2007 9:18 am 
Newbie

Joined: Tue Nov 20, 2007 10:37 am
Posts: 4
emmanuel wrote:
Because what is forbidden (and impossible) is loading more than one bag per SQL query. If you so it using different queries you're fine.

And yes the combination of annotations is valid but I would have used SUBSELECT I think


Thanks Emmanuel, I understand. I try to use mix of annotation EAGER + SUBSELECT to use different queries so I stand up multiple bag.
Thanks a lot.

_________________
GURU JR_JAVARUDE..a new philosophy...


Top
 Profile  
 
 Post subject: Hibernate Search - "Access a Sealed WorkQueue..."
PostPosted: Wed Dec 05, 2007 9:52 pm 
Newbie

Joined: Wed Dec 05, 2007 9:17 pm
Posts: 4
Hi,

I'm replying here to this thread because this is the only place that had mentioned something I'm seeing when I run my code.

I am trying to index (and retrieve in search results) a java.util.Date property and a java.util.Set property in my managed entity Product:

Code:
@Entity
@Table(name = "PRODUCT")
@Indexed(index = "Product")
public abstract class Product extends BaseEntity implements Serializable {

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "CREATE_DATE", updatable=false)
    @Field(index = Index.UN_TOKENIZED, store = Store.YES)
    @DateBridge(resolution = Resolution.MINUTE)
    private Date createDate;

    @OneToMany(cascade = { CascadeType.ALL, CascadeType.REMOVE })
    @Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
    @JoinColumn(name = "PRODUCT_ID", nullable = false)
    @IndexedEmbedded(depth = 2)
    private Set<LocaleAwareMetadata> allLocaleAwareMetadata =
        new HashSet<LocaleAwareMetadata>();
}


// Entity LocaleAwareMetadata:

@Entity
@Table(name = "METADATA")
@Indexed(index = "LocaleAwareMetadata")
@ClassBridge(
    name  = "display_title_studio_network",
    index = Index.UN_TOKENIZED,
    store = Store.YES,
    impl = LocaleAwareMetadataClassBridge.class)
public class LocaleAwareMetadata extends BaseEntity implements Serializable {
    // LocaleAwareMetadataClassBridge combines some properties for indexing

    // properties omitted
}


// In my service impl:

Session session = null;
try {
    // Spring's HibernateDaoSupport.getSessionFactory()
    session = getSessionFactory().openSession();

    FullTextSession fullTextSession = Search
        .createFullTextSession(session);

    fullTextSession.setFlushMode(FlushMode.MANUAL);
    fullTextSession.setCacheMode(CacheMode.IGNORE);

    Transaction tx = fullTextSession.beginTransaction();
   
    ScrollableResults results =
        fullTextSession.createCriteria(Product.class)
        .setFetchMode("allLocaleAwareMetadata", FetchMode.JOIN)
        .scroll(ScrollMode.FORWARD_ONLY);

    int index = 0;
    while (results.next()) {
        index++;
        fullTextSession.index(results.get(0));

        if (index % 10 == 0) {
            //clear every batchSize since the queue is processed
            fullTextSession.clear();
        }
    }
    tx.commit();
}
catch (HibernateException e) {
    logger.error("Caught an exception while performing indexing", e);
}
if (null != session) {
    session.close();
}



When I run the indexing code in my service implementation, I get the following stack traces:

Code:
17:40:28-700 ERROR te.LazyInitializationException   failed to lazily initialize a collection of role: com.connect.vine.product.Product.allCountryAwareMetadata, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.connect.vine.product.Product.allCountryAwareMetadata, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
        at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:554)
        at org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:514)
        at org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:431)
        at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:122)
        at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:44)
        at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
        at com.connect.vine.search.SearchManagerImpl.index(SearchManagerImpl.java:181)

(snip...)

17:40:28-935 ERROR te.transaction.JDBCTransaction   exception calling user Synchronization
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.connect.vine.product.Product.allCountryAwareMetadata, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:163)
        at org.hibernate.search.engine.DocumentBuilder.buildDocumentFields(DocumentBuilder.java:554)
        at org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:514)
        at org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:431)
        at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:122)
        at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:44)
        at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
        at com.connect.vine.search.SearchManagerImpl.index(SearchManagerImpl.java:181)

(snip...)

17:40:29-154 ERROR ations.common.AssertionFailure   an assertion failure occured (this may indicate a bug in Hibernate)
org.hibernate.annotations.common.AssertionFailure: Access a Sealed WorkQueue whcih has not been sealed
        at org.hibernate.search.backend.WorkQueue.getSealedQueue(WorkQueue.java:48)
        at org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWorks(BatchedQueueingProcessor.java:130)
        at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:50)
        at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsAfterTransactionCompletion(JDBCTransaction.java:243)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:121)
        at com.connect.vine.search.SearchManagerImpl.index(SearchManagerImpl.java:181)

(snip...)



I can't figure out what I'm doing wrong - if it's my annotations or indexing code. Can someone help?

Thanks in advance!

-Frank


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 05, 2007 11:34 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you need to add hibernate.search.worker.batch_size 10

http://www.hibernate.org/hib_docs/search/reference/en/html_single/#search-batchindex

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.