My company have a custom Web application built on Spring 3.0.5.RELEASE, Hibernate Core 3.6.3.Final, Hibernate search 3.4.0.Final, Hibernate validator 4.1.0.Final, Aspectjrt 1.6.2. We had all the integration test running successful and web application working fine. I wanted to upgrade the libraries to Spring 3.1.2.RELEASE, Hibernate Core 4.1.6.Final, Hibernate search 4.1.1.Final, Hibernate validator 4.3.0.Final. Had to do some changes due to classes deprecation/changes. No changes in the configuration overall. I startup the application and the web application works perfectly fine. I had some compatibility issues with HSQL, which we use for JUnit tests. So I had to upgrade hsqldb from 1.8.0.7 to 2.2.9. Now the Integration tests fail with the following error:
javax.validation.ValidationException: HV000028: Unexpected exception during isValid call. at org.hibernate.validator.internal.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:294) at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:164) at org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:125) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:86) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:442) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:387) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:351) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:303) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:133) at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:136) at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:94) at org.hibernate.action.internal.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:178) at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:75) at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362) at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:203) at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:183) at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:167) at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:320) at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287) at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:844) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:819) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:823) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:865) 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.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) at $Proxy127.persist(Unknown Source) at xx..dao.jpa.GenericJpaDao.persist(GenericJpaDao.java:53) 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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy130.persist(Unknown Source) at xx..AbstractPersistentEntity.persist_aroundBody20(AbstractPersistentEntity.java:229) at xx..AbstractPersistentEntity.persist_aroundBody21$advice(AbstractPersistentEntity.java:51) at xx..AbstractPersistentEntity.persist(AbstractPersistentEntity.java:1) at xx..AbstractPersistentEntity.persist_aroundBody10(AbstractPersistentEntity.java:159) at xx..AbstractPersistentEntity.persist_aroundBody11$advice(AbstractPersistentEntity.java:51) at xx..AbstractPersistentEntity.persist(AbstractPersistentEntity.java:159) at xx..common.UpgradeIntTest.testSimplePersist(UpgradeIntTest.java:29) 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 junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:79) at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$1(AbstractAnnotationAwareTransactionalTests.java:1) at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:179) at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:287) at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:258) at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:176) at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:195) at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:276) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.hibernate.AssertionFailure: null id in xx..common.User entry (don't flush the Session after an exception occurs) at org.hibernate.event.internal.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:79) at org.hibernate.event.internal.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:194) at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:156) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:225) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58) at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1186) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1615) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374) at xx..validate.UniqueValidator.isUnique(UniqueValidator.java:66) at xx..validate.UniqueValidator.isValid(UniqueValidator.java:36) at xx..validate.UniqueValidator.isValid(UniqueValidator.java:1) at org.hibernate.validator.internal.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:291) ... 80 more
When I create a simple integration test to simply persist one object, it works. When I change the test to add a different object to persist, it fails with this error. It looks like something gets messed up with the session while persisting different objects. I have been working on this upgrade for a while now, after so many hurdles, when the application started working, this error with the tests is so frustrating. Can someone help me/ point me if I am missing something?
|