title: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.spring.webapp.lojavirtual.acesso.persistence.model.Usuario
body: <p>In my spring project, I have implemented a generic class to serve as base for all my Dao class. By example, my class UsuarioHome have this code:</p>
  
  <pre><code>@Repository
  public class UsuarioHome extends Dao&lt;Usuario&gt; {
  
      public UsuarioHome() {
          super(Usuario.class);
      }
  
  }
  </code></pre>
  
  <p>and my generic class has this code:</p>
  
  <pre><code>public class Dao&lt;E&gt; {
  
      private final E entity;
  
      @Autowired
      SessionFactory sessionFactory;
  
      protected Session getCurrentSession(){
          return sessionFactory.getCurrentSession();
      }
  
      public Dao(E entity) {  
          this.entity = entity;
      }
  
      @SuppressWarnings("unchecked")
      public Dao(Class&lt;?&gt; classe) {
          this.entity = (E) classe;
      }
  
      public E getEntity() {
          return this.entity;
      }
  
      @Transactional
      public boolean persist(E transientInstance) {
          try {
              sessionFactory.getCurrentSession().persist(transientInstance);
              return true;
          } catch (RuntimeException re) {
              return false;
          }
      }
  
      @Transactional
      public boolean remove(E transientInstance) {
          try {
              sessionFactory.getCurrentSession().delete(transientInstance);
              return true;
          } catch (RuntimeException re) {
              return false;
          }
      }
  
      @Transactional
      public boolean merge(E detachedInstance) {
          try {
              sessionFactory.getCurrentSession().merge(detachedInstance);
              return true;
          } catch (RuntimeException re) {
              return false;
          }
      }
  
      @SuppressWarnings("unchecked")
      @Transactional
      public E findById(int id) {
          try {
              E instance = (E) sessionFactory.getCurrentSession().get(entity.getClass(), id);
              return instance;
          } catch (RuntimeException re) {
              return null;
          }
      }
  
      @SuppressWarnings("unchecked")
      @Transactional
      public E findByField(String field, String value) {
          try {
              String expressao = entity.toString();
              String nome_classe = new String();
              StringTokenizer st = new StringTokenizer(expressao);
              while (st.hasMoreTokens()) {
                  nome_classe = st.nextToken();
              }
              String query = "from "+nome_classe+" where "+field+" = :data";
  
              Query q = sessionFactory.getCurrentSession().createQuery(query);
              q.setParameter("data", value);
              E instance = (E) q.uniqueResult();
              return instance;
          } catch (RuntimeException re) {
              return null;
          }
      }
  
      @SuppressWarnings("unchecked")
      @Transactional
      public List&lt;E&gt; findAll() {
          try {
              List&lt;E&gt; instance = sessionFactory.getCurrentSession().createCriteria(entity.getClass()).list();
              return instance;
          } catch (RuntimeException re) {
              return null;
          }
      }
  
  }
  </code></pre>
  
  <p>But, when I need retrieve a list of all items from the table, I am receiving 0 items. The method for do this is placed in my class UsuarioService:</p>
  
  <pre><code>@Transactional
  public List&lt;Usuario&gt; listagem_usuarios() {
      return usuario.findAll();
  }
  </code></pre>
  
  <p>where I autowires my Dao class:</p>
  
  <pre><code>@Autowired
  private UsuarioHome usuario;
  
  @Autowired
  private GrupoPermissaoHome grupo_permissao;
  </code></pre>
  
  <p>Anyone can tell what I am doing wrong here? I tested this solution in other projects (simpler than that), and it work.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>When I try run the application, I am facing a cast error, like this, by example, when this json page is opened:</p>
  
  <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %&gt;
  &lt;json:object&gt;
  &lt;c:forEach var="item" items="${lista}"&gt;
        &lt;json:object name="usuario"&gt;
           &lt;json:property name="id" value="${item.id}"/&gt;
           &lt;json:property name="login" value="${item.login}"/&gt;
           &lt;json:property name="pnome" value="${item.first_name}"/&gt;
           &lt;json:property name="unome" value="${item.last_name}"/&gt;
           &lt;json:property name="email" value="${item.email}"/&gt;
        &lt;/json:object&gt;
  &lt;/c:forEach&gt;
  &lt;/json:object&gt;
  </code></pre>
  
  <p>the console shows this error:</p>
  
  <pre><code>Grave: Servlet.service() for servlet jsp threw exception
  java.lang.NumberFormatException: For input string: "id"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      at java.lang.Integer.parseInt(Integer.java:492)
      at java.lang.Integer.parseInt(Integer.java:527)
      at javax.el.ArrayELResolver.coerce(ArrayELResolver.java:166)
      at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:46)
      at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104)
      at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
      at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1026)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fproperty_005f0(listagem_005fusuarios_jsp.java:168)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp.access$1(listagem_005fusuarios_jsp.java:156)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke1(listagem_005fusuarios_jsp.java:271)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke(listagem_005fusuarios_jsp.java:310)
      at atg.taglib.json.JsonObjectTag.doTag(JsonObjectTag.java:63)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fobject_005f1(listagem_005fusuarios_jsp.java:151)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_c_005fforEach_005f0(listagem_005fusuarios_jsp.java:117)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp.access$0(listagem_005fusuarios_jsp.java:98)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke0(listagem_005fusuarios_jsp.java:261)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke(listagem_005fusuarios_jsp.java:307)
      at atg.taglib.json.JsonObjectTag.doTag(JsonObjectTag.java:63)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fobject_005f0(listagem_005fusuarios_jsp.java:93)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspService(listagem_005fusuarios_jsp.java:68)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      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.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(FilterSecurityInterceptor.java:84)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$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(AnonymousAuthenticationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
      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.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
      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.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.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.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      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:312)
      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)
  
  Mai 20, 2014 7:40:22 AM org.apache.catalina.core.StandardWrapperValve invoke
  Grave: Servlet.service() for servlet [json_dispatcher] in context with path [/loja] threw exception [An exception occurred processing JSP page /WEB-INF/view/json/listagem_usuarios.jsp at line 5
  
  2: &lt;%@ taglib prefix="json" uri="http://www.atg.com/taglibs/json" %&gt;
  3: &lt;json:object&gt;
  4: &lt;c:forEach var="item" items="${lista}"&gt;
  5:    &lt;json:object name="usuario"&gt;
  6:       &lt;json:property name="id" value="${item.id}"/&gt;
  7:       &lt;json:property name="login" value="${item.login}"/&gt;
  8:       &lt;json:property name="pnome" value="${item.first_name}"/&gt;
  
  
  Stacktrace:] with root cause
  java.lang.NumberFormatException: For input string: "id"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      at java.lang.Integer.parseInt(Integer.java:492)
      at java.lang.Integer.parseInt(Integer.java:527)
      at javax.el.ArrayELResolver.coerce(ArrayELResolver.java:166)
      at javax.el.ArrayELResolver.getValue(ArrayELResolver.java:46)
      at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104)
      at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
      at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
      at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1026)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fproperty_005f0(listagem_005fusuarios_jsp.java:168)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp.access$1(listagem_005fusuarios_jsp.java:156)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke1(listagem_005fusuarios_jsp.java:271)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke(listagem_005fusuarios_jsp.java:310)
      at atg.taglib.json.JsonObjectTag.doTag(JsonObjectTag.java:63)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fobject_005f1(listagem_005fusuarios_jsp.java:151)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_c_005fforEach_005f0(listagem_005fusuarios_jsp.java:117)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp.access$0(listagem_005fusuarios_jsp.java:98)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke0(listagem_005fusuarios_jsp.java:261)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp$Helper.invoke(listagem_005fusuarios_jsp.java:307)
      at atg.taglib.json.JsonObjectTag.doTag(JsonObjectTag.java:63)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspx_meth_json_005fobject_005f0(listagem_005fusuarios_jsp.java:93)
      at org.apache.jsp.WEB_002dINF.view.json.listagem_005fusuarios_jsp._jspService(listagem_005fusuarios_jsp.java:68)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      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.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(FilterSecurityInterceptor.java:84)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$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(AnonymousAuthenticationFilter.java:113)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
      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.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
      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.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.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.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      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:312)
      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)
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>After more tests, I verify that when I use:</p>
  
  <pre><code>List&lt;E&gt; instance = sessionFactory.getCurrentSession().createCriteria(entity.getClass()).list();
  </code></pre>
  
  <p>I get an empty list. But when I use:</p>
  
  <pre><code>List&lt;E&gt; instance = (List&lt;E&gt;) sessionFactory.getCurrentSession().createSQLQuery("select * from usuario").list();
  </code></pre>
  
  <p>I get the data from database, but I can access them, due to an cast error (explained above in the first update)</p>
  
  <p>ps.: the other methods, findById and findByField, are working fine.</p>