The controller receives a request to remove an object. It uses OSIVF and try to remove the object. An exception is throw in DAO layer and catched in the controller with a showForm return to the user (should present the error).
But when the view is rendered a LIE occours, but Session is on thread!
See the logs:
Code:[academico] DEBUG [http-80-5] OpenSessionInViewFilter.lookupSessionFactory(214) | Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter [academico] DEBUG [http-80-5] OpenSessionInViewFilter.doFilterInternal(156) | Opening single Hibernate Session in OpenSessionInViewFilter [academico] DEBUG [http-80-5] SessionFactoryUtils.doGetSession(333) | Opening Hibernate Session ... [academico] DEBUG [http-80-5] HibernateTransactionManager.doGetTransaction(390) | Found thread-bound Session [org.hibernate.impl.SessionImpl@1aefd28] for Hibernate transaction [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.getTransaction(319) | Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@3f67dc] [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.getTransaction(347) | Creating new transaction with name [br.edu.unoesc.academico.service.alunoCurso.AlunoManager.removeAlunoCurso]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-Exception [academico] DEBUG [http-80-5] HibernateTransactionManager.doBegin(440) | Preparing JDBC Connection of Hibernate Session [org.hibernate.impl.SessionImpl@1aefd28] [academico] DEBUG [http-80-5] HibernateTransactionManager.doBegin(511) | Exposing Hibernate transaction as JDBC transaction [org.apache.commons.dbcp.PoolableConnection@1bc2c97] [academico] DEBUG [http-80-5] AlunoCursoDAOHibernate.removeAlunoCurso(102) | removing alunoCurso: 12570 [academico] DEBUG [http-80-5] HibernateTemplate.execute(359) | Found thread-bound Session for HibernateTemplate [academico] DEBUG [http-80-5] HibernateTemplate.execute(383) | Not closing pre-bound Hibernate Session after HibernateTemplate [academico] DEBUG [http-80-5] HibernateTemplate.execute(359) | Found thread-bound Session for HibernateTemplate [academico] DEBUG [http-80-5] HibernateTemplate.execute(383) | Not closing pre-bound Hibernate Session after HibernateTemplate [academico] DEBUG [http-80-5] HibernateTemplate.execute(359) | Found thread-bound Session for HibernateTemplate Hibernate: delete from ALU_CURSO where CODALUCURSO=? and VERSAO=? [academico] WARN [http-80-5] JDBCExceptionReporter.logExceptions(77) | SQL Error: 2292, SQLState: 23000 [academico] ERROR [http-80-5] JDBCExceptionReporter.logExceptions(78) | ORA-02292: restrição de integridade (ACAD_UNOESC.ACS_ALC_FK) violada - registro filho localizado [academico] ERROR [http-80-5] AbstractFlushingEventListener.performExecutions(301) | Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: could not delete: [br.edu.unoesc.academico.model.alunoCurso.AlunoCurso#12570] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2541) at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697) at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:806) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367) at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:804) at br.edu.unoesc.academico.dao.alunoCurso.hibernate.AlunoCursoDAOHibernate.removeAlunoCurso(AlunoCursoDAOHibernate.java:107) at br.edu.unoesc.academico.service.alunoCurso.impl.AlunoManagerImpl.removeAlunoCurso(AlunoManagerImpl.java:391) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210) at $Proxy15.removeAlunoCurso(Unknown Source) at br.edu.unoesc.academico.webapp.action.alunoCurso.AlunoCursoFormController.onSubmit(AlunoCursoFormController.java:46) at ... [academico] DEBUG [http-80-5] HibernateTemplate.execute(383) | Not closing pre-bound Hibernate Session after HibernateTemplate [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.triggerBeforeCompletion(832) | Triggering beforeCompletion synchronization [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.processRollback(743) | Initiating transaction rollback [academico] DEBUG [http-80-5] HibernateTransactionManager.doRollback(577) | Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@1aefd28] // catch exception and do a showForm(request, response, erros on spring controller [academico] DEBUG [http-80-5] HibernateTemplate.execute(359) | Found thread-bound Session for HibernateTemplate Hibernate: select cursohabil0_.CODCURHABILITACAO as CODCURHA1_497_, cursohabil0_.VERSAO as VERSAO497_, cursohabil0_.CODCURSO as CODCURSO497_, cursohabil0_.CODHABILITACAO as CODHABIL4_497_, cursohabil0_.NOMHABILITACAO as NOMHABIL5_497_, cursohabil0_.NOMCONSULTA as NOMCONSU6_497_, cursohabil0_.NOMHABESPECIFICA as NOMHABES7_497_, cursohabil0_.APLHABILITACAO as APLHABIL8_497_, cursohabil0_.DATCADASTRO as DATCADAS9_497_, cursohabil0_.DATRECONHECIMENTO as DATRECO10_497_, cursohabil0_.NUMRECONHECIMENTO as NUMRECO11_497_, cursohabil0_.ORGRECONHECIMENTO as ORGRECO12_497_, cursohabil0_.OBSRECONHECIMENTO as OBSRECO13_497_, cursohabil0_.DATENTVIGOR as DATENTV14_497_, cursohabil0_.DATFIMVIGOR as DATFIMV15_497_, cursohabil0_.DESCOBJETIVO as DESCOBJ16_497_, cursohabil0_.DESCMERCADO as DESCMER17_497_, cursohabil0_.DESCCONVENIO as DESCCON18_497_, cursohabil0_.DESCPUBLICO as DESCPUB19_497_, cursohabil0_.QTDVAGAS as QTDVAGAS497_, cursohabil0_.REGMATRICULA as REGMATR21_497_, cursohabil0_.DURACAO as DURACAO497_, cursohabil0_.TIPOFERECIMENTO as TIPOFER23_497_ from CUR_HABILITACAO cursohabil0_ where cursohabil0_.CODCURSO=? [academico] DEBUG [http-80-5] HibernateTemplate.execute(383) | Not closing pre-bound Hibernate Session after HibernateTemplate [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.triggerBeforeCommit(819) | Triggering beforeCommit synchronization [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.triggerBeforeCompletion(832) | Triggering beforeCompletion synchronization [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.processCommit(652) | Initiating transaction commit [academico] DEBUG [http-80-5] HibernateTransactionManager.doCommit(558) | Committing Hibernate transaction on Session [org.hibernate.impl.SessionImpl@1aefd28] [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.triggerAfterCommit(845) | Triggering afterCommit synchronization [academico] DEBUG [http-80-5] AbstractPlatformTransactionManager.triggerAfterCompletion(861) | Triggering afterCompletion synchronization [academico] DEBUG [http-80-5] HibernateTransactionManager.doCleanupAfterCompletion(644) | Not closing pre-bound Hibernate Session [org.hibernate.impl.SessionImpl@1aefd28] after transaction [academico] ERROR [http-80-5] LazyInitializationException.<init>(19) | could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150) at br.edu.unoesc.academico.model.pessoa.Pessoa$$EnhancerByCGLIB$$8618754c.getNome(<generated>) at br.edu.unoesc.academico.model.alunoCurso.Aluno.toString(Aluno.java:187) [academico] DEBUG [http-80-5] OpenSessionInViewFilter.doFilterInternal(182) | Closing single Hibernate Session in OpenSessionInViewFilter [academico] DEBUG [http-80-5] SessionFactoryUtils.closeSession(781) | Closing Hibernate Session


Reply With Quote