Title: Occasional exception org.hibernate.QueryException: could not resolve property
Tags: java;multithreading;spring;hibernate;high-load
Question: Issue:
In our web application under high load sometimes, when there are two simultaneous Hibernate queries in different threads (in same millisecond), we have two exceptions (in both threads): "org.hibernate.QueryException: could not resolve property" on different entities and different properties.
It looks like two queries have exchanged their property mappings for some reason so AbstractPropertyMapping class can't find required property in mappings of other query's entity and raises QueryException. Each entity is used only in one thread.
Environment:
Apache Tomcat 7
Spring 4.0.6
Hibernate 4.3.6.Final
Configuration:
<!-- Configuration --&gt;
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
<property name="sessionFactory" ref="sessionFactory" /&gt;
<property name="nestedTransactionAllowed" value="true" /&gt;
</bean&gt;
<bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate"&gt;
<property name="transactionManager" ref="transactionManager"/&gt;
</bean&gt;
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
<property name="dataSource" ref="dataSource" /&gt;
<property name="packagesToScan"&gt;
<list&gt;
<value&gt;com.delta.invest.domain</value&gt;
</list&gt;
</property&gt;
<property name="hibernateProperties"&gt;
<props&gt;
<prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect</prop&gt;
<prop key="hibernate.connection.charSet"&gt;UTF-8</prop&gt;
<!-- For debuging purposes --&gt;
<prop key="hibernate.show_sql"&gt;false</prop&gt;
<prop key="hibernate.format_sql"&gt;true</prop&gt;
<prop key="hibernate.use_sql_comments"&gt;true</prop&gt;
<!-- @see: http://community.jboss.org/wiki/HibernateCoreMigrationGuide36 --&gt;
<prop key="hibernate.jdbc.use_streams_for_binary"&gt;false</prop&gt;
<!-- For batch inserts --&gt;
<prop key="hibernate.jdbc.batch_size"&gt;20</prop&gt;
<prop key="hibernate.order_inserts"&gt;true</prop&gt;
<prop key="hibernate.order_updates"&gt;true</prop&gt;
<prop key="hibernate.jdbc.batch_versioned_data"&gt;true</prop&gt;
<!-- prop key="hibernate.cache.use_second_level_cache"&gt;false</prop--&gt;
<!-- Second-level cache --&gt;
<prop key="hibernate.cache.use_second_level_cache"&gt;true</prop&gt;
<prop key="hibernate.cache.region.factory_class"&gt;org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop&gt;
<prop key="hibernate.cache.provider_configuration_file_resource_path"&gt;ehcache.xml</prop&gt;
<!-- Autoregister Joda types --&gt;
<prop key="jadira.usertype.autoRegisterUserTypes"&gt;true</prop&gt;
<!-- Turn off domain classes validation --&gt;
<prop key="javax.persistence.validation.mode"&gt;none</prop&gt;
<!-- Set TRANSACTION_READ_COMMITTED isolation level --&gt;
<prop key="hibernate.connection.isolation"&gt;2</prop&gt;
</props&gt;
</property&gt;
</bean&gt;
Exception in first thread:
Caused by: org.hibernate.QueryException: could not resolve property: accountTo of: com.delta.invest.domain.entity.core.A
cbutler@example.net(AbstractPropertyMapping.java:83)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1978)
at org.hibernate.loader.criteria.EntityCriteriaInfoProvider.getType(EntityCriteriaInfoProvider.java:57)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getPathInfo(CriteriaQueryTranslator.java:245)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaEntityNameMap(CriteriaQueryTranslator.jav
a:229)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init&gt;(CriteriaQueryTranslator.java:112)
at org.hibernate.loader.criteria.CriteriaLoader.<init&gt;(CriteriaLoader.java:88)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1663)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:380)
at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:402)
at com.delta.invest.dao.kernel.SelectionDAOImpl.getCount(SelectionDAOImpl.java:216)
at com.delta.invest.service.SelectionServiceImpl.getRowCountByCriteria(SelectionServiceImpl.java:406)
at com.delta.invest.service.SelectionServiceImpl.getSize(SelectionServiceImpl.java:185)
at sun.reflect.GeneratedMethodAccessor422.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterce
ptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspec
tSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy99.getSize(Unknown Source)
at com.delta.invest.service.PageSelectionServiceImpl.getSize(PageSelectionServiceImpl.java:60)
at com.delta.invest.paging.PagingCollection.size(PagingCollection.java:64)
at com.delta.invest.ws.document.DocumentWebServiceImpl.getDocumentsHistoryForOperator(DocumentWebServiceImpl.jav
a:344)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterce
ptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspec
tSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy99.getSize(Unknown Source)
at com.delta.invest.service.PageSelectionServiceImpl.getSize(PageSelectionServiceImpl.java:60)
at com.delta.invest.paging.PagingCollection.size(PagingCollection.java:64)
at com.delta.invest.ws.document.DocumentWebServiceImpl.getDocumentsHistoryForOperator(DocumentWebServiceImpl.jav
a:344)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.
java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:73)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy220.getDocumentsHistoryForOperator(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
... 91 more
Exception in second thread:
org.hibernate.QueryException: could not resolve property: accountTo of: cbutler@example.net(AbstractPropertyMapping.java:83)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1978)
at org.hibernate.loader.criteria.EntityCriteriaInfoProvider.getType(EntityCriteriaInfoProvider.java:57)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getPathInfo(CriteriaQueryTranslator.java:245)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaEntityNameMap(CriteriaQueryTranslator.jav
a:229)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init&gt;(CriteriaQueryTranslator.java:112)
at org.hibernate.loader.criteria.CriteriaLoader.<init&gt;(CriteriaLoader.java:88)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1663)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:380)
at com.delta.invest.dao.kernel.SelectionDAOImpl.list(SelectionDAOImpl.java:159)
at com.delta.invest.service.SelectionServiceImpl.getAll(SelectionServiceImpl.java:358)
at sun.reflect.GeneratedMethodAccessor524.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterce
ptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspec
tSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy99.getAll(Unknown Source)
at com.delta.invest.service.TransactionServiceImpl.getLinkedAccountEntries(TransactionServiceImpl.java:1479)
at com.delta.invest.service.TransactionServiceImpl.executeTransaction(TransactionServiceImpl.java:743)
at sun.reflect.GeneratedMethodAccessor713.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInte
rceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterce
ptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspec
tSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy112.executeTransaction(Unknown Source)
at com.delta.invest.processing.operation.CreateTransactionOperation.commitTransaction(CreateTransactionOperation
.java:82)
at com.delta.invest.processing.operation.CreateTransactionOperation.execute(CreateTransactionOperation.java:50)
at com.delta.invest.processing.DocumentLifecycleManagerImpl.executeDocumentaryOperations(DocumentLifecycleManage
rImpl.java:181)
at com.delta.invest.processing.DocumentLifecycleManagerImpl.process(DocumentLifecycleManagerImpl.java:110)
at com.delta.invest.processing.DocumentLifecycleManagerImpl.process(DocumentLifecycleManagerImpl.java:188)
at com.delta.invest.service.DocumentServiceImpl.process(DocumentServiceImpl.java:229)
at sun.reflect.GeneratedMethodAccessor729.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInte
rceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterce
ptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspec
tSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy116.process(Unknown Source)
at com.delta.invest.service.remote.RemoteSupportServiceImpl.process(RemoteSupportServiceImpl.ja
va:367)
at sun.reflect.GeneratedMethodAccessor709.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor
.java:78)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy260.process(Unknown Source)
at sun.reflect.GeneratedMethodAccessor709.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:306)
at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:221)
at org.springframework.remoting.caucho.HessianExporter.doInvoke(HessianExporter.java:223)
at org.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:138)
at org.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:66)
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.j
ava:152)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at ch.qos.logback.access.servlet.TeeFilter.doFilter(TeeFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:202)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.
java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityIntercepto
r.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:cbutler@example.net$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticatio
nFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextH
olderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:cbutler@example.net$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(Abs
tractPreAuthenticatedProcessingFilter.java:94)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebA
syncManagerIntegrationFilter.java:50)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistence
Filter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:189)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Source code:
@Repository(value="selectionDAO")
public class SelectionDAOImpl implements SelectionDAO
...
@Autowired
private SessionFactory sessionFactory;
...
public <Entity&gt; List<Entity&gt; list( Class<Entity&gt; entityClass, final DetachedCriteria detachedCriteria,
final int firstResult, final int maxResults )
Criteria criteria = detachedCriteria.getExecutableCriteria(sessionFactory.getCurrentSession());
if ( firstResult &gt; 0 ) { criteria.setFirstResult( firstResult ); }
if ( maxResults &gt; 0 ) { criteria.setMaxResults( maxResults ); }
return (List<Entity&gt;) criteria.list();
public Long getCount( final DetachedCriteria detachedCriteria )
return (Long) detachedCriteria.getExecutableCriteria(sessionFactory.getCurrentSession()).setProjection( Projections.rowCount() ).uniqueResult();
...
How can I prevent this exception?
Thank you in advance.
Comment: You need to add the stacktrace too.

Comment: Maybe you crated `DetachedCriteria` for the wrong entity than the one you're expecting.

Comment: How do you instantiate your Hibernate sessions ? Are you sure that each requests (thread) get a different instance ?

Comment: @lambda.xy.x If there is possibility of a configuration mistake do you have any thoughts on what kind of mistake it could be?

Comment: Stéphane, using Spring @Transactional  annotation. As far as I know, in case of HibernateTransactionManager Spring should put Session in Thread Local context, so each thread should have different instance. I'll check it.

Comment: @VladMihalcea in that case I would have constant exceptions, not occasional.

Comment: So there are different Session instances. Other exception I got under close circumstances is: cbutler@example.net(CriteriaQueryTranslator.java:417)

Comment: Concurrency problems are usually hard to debug. It may be a configuration mistake, but if it isn't, without the client's hibernation calls, I don't think there is a likely chance in finding the problem.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 8, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:04/25/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><multithreading><spring><hibernate><high-load>', 'Title': 'Occasional exception org.hibernate.QueryException: could not resolve property', 'ViewCount': 632, 'id': 29870080, 'user_AboutMe': None, 'user_AccountId': 6203965.0, 'user_DisplayName': 'eupakhomov', 'user_Reputation': 21.0, 'user_Views': 5.0, 'user_id': 4832724.0}}