[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1305) Better exception message for version type mismatch

Brian Viveiros (JIRA) noreply at atlassian.com
Thu Sep 7 09:08:24 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1305?page=comments#action_24357 ] 

Brian Viveiros commented on HHH-1305:
-------------------------------------

I'm seeing this when a JBPM timer triggers an Action.  The Action creates a new hibernate session and does some database work then comits.

The following line in org.jbpm.scheduler.impl.SchedulerThread.executeTimers() results in the exception:

          // save the process instance
          jbpmContext.save(timer.getProcessInstance());

Is there a workaround to suppress this message?  I can set logging to something higer than INFO but then I might miss out on other messages.

Thanks.

> Better exception message for version type mismatch
> --------------------------------------------------
>
>          Key: HHH-1305
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1305
>      Project: Hibernate3
>         Type: Improvement

>   Components: core
>     Versions: 3.1 rc3
>     Reporter: Tom Baeyens
>     Priority: Minor

>
>
> Documentation says correctly that the default type of a version is integer.  When you don't specify the type and use a long member field, hibernate doesn't use reflection to determine the type of the version member field and generates an exception that doesn't really relate to the problem:
> java.lang.RuntimeException: problem closing service 'org.jbpm.persistence.db.DbPersistenceService at 1292d12'
> 	at org.jbpm.svc.Services.close(Services.java:179)
> 	at org.jbpm.JbpmContext.close(JbpmContext.java:116)
> 	at org.jbpm.db.AbstractDbTestCase.closeJbpmContext(AbstractDbTestCase.java:108)
> 	at org.jbpm.db.AbstractDbTestCase.tearDown(AbstractDbTestCase.java:39)
> 	at junit.framework.TestCase.runBare(TestCase.java:130)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.jbpm.persistence.PersistenceException: couldn't commit hibernate session
> 	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:118)
> 	at org.jbpm.svc.Services.close(Services.java:172)
> 	... 19 more
> Caused by: org.hibernate.AssertionFailure: null id in org.jbpm.graph.exe.ProcessInstance entry (don't flush the Session after an exception occurs)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:48)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:140)
> 	at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:97)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
> 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
> 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:877)
> 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:344)
> 	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
> 	at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:116)
> 	... 20 more
> The exception is thrown from DefaultFlushEventListener.checkId:
> 	/**
> 	 * make sure user didn't mangle the id
> 	 */
> 	public void checkId(Object object, EntityPersister persister, Serializable id, EntityMode entityMode)
> 	throws HibernateException {
> 		if ( persister.hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) {
> 			Serializable oid = persister.getIdentifier( object, entityMode );
> 			if (id==null) {
> 				throw new AssertionFailure("null id in " + persister.getEntityName() + " entry (don't flush the Session after an exception occurs)");
> 			}
> 			if ( !persister.getIdentifierType().isEqual(id, oid, entityMode) ) {
> 				throw new HibernateException(
> 						"identifier of an instance of " +
> 						persister.getEntityName() +
> 						" was altered from " + id +
> 						" to " + oid
> 					);
> 			}
> 		}
> 	}
> regards, tom.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list