1. java
  2. android
  3. c#
  4. .net
  5. javascript
  6. php
  7. jquery
  8. html
  9. sql

StackOverflowError no select com Hibernate

public class Matricula extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;  

    @OneToOne(cascade= CascadeType.REFRESH, fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name="TIPO_COLABORADOR_ID", referencedColumnName = "id", nullable = false)
    private TipoColaborador tipoColaborador;   
}
public class TipoColaborador extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Column
    private String descricao;
    @Column
    private String sigla;
}

Ao executar essa HQL select max(m.numMatricula)+1 from Matricula m INNER JOIN FETCH m.tipoColaborador t where t.id like 1 dá esse erro aqui... O erro continua por mais umas 50 linhas que eu não vou postar aqui pra não ficar muito grade. Hashcode, Equals, ToString, Serializable... tudo implementado. Ah, e o atributo ID vem da BaseEntity.

WARNING: #{matriculaBean.validateMatricula()}: java.lang.StackOverflowError javax.faces.FacesException: #{matriculaBean.validateMatricula()}: java.lang.StackOverflowError at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) 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.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) 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.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) 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.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) at java.lang.Thread.run(Thread.java:724) Caused by: javax.faces.el.EvaluationException: java.lang.StackOverflowError at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) ... 64 more Caused by: java.lang.StackOverflowError at java.util.Vector.iterator(Vector.java:1114) at java.util.AbstractList.hashCode(AbstractList.java:540) at java.util.Vector.hashCode(Vector.java:988) at org.eclipse.persistence.indirection.IndirectList.hashCode(IndirectList.java:469) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Cargo.hashCode(Cargo.java:58) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:82) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:83) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:83) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:83) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:83) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Lotacao.hashCode(Lotacao.java:83) at java.util.AbstractList.hashCode(AbstractList.java:541) at java.util.Objects.hashCode(Objects.java:96) at org.hupaaufal.rh.model.Matricula.hashCode(Matricula.java:158)

  • Tente trocar sua query de select max(m.numMatricula)+1 from Matricula m INNER JOIN FETCH m.tipoColaborador t where t.id like 1 para select max(m.numMatricula)+1 from Matricula m INNER JOIN FETCH m.tipoColaborador t where t.id = 1

    felipe_gdr   04 de dez de 2013
  1. Você vai ver essas setas em qualquer página de pergunta. Com elas, você pode dizer se uma pergunta ou uma resposta foram relevantes ou não.
  2. Edite sua pergunta ou resposta caso queira alterar ou adicionar detalhes.
  3. Caso haja alguma dúvida sobre a pergunta, adicione um comentário. O espaço de respostas deve ser utilizado apenas para responder a pergunta.
  4. Se o autor da pergunta marcar uma resposta como solucionada, esta marca aparecerá.
  5. Clique aqui para mais detalhes sobre o funcionamento do GUJ!

0 resposta

Não é a resposta que estava procurando? Procure outras perguntas com as tags hibernate java jpa memória ou faça a sua própria pergunta.