Hibernate 3.5.6 + Spring 3.0.5
JDK 7
Oracle 11g
I am seeing intermittent problems with my application that has been running for many months without issue.
The error presents itself as:
Code:
Caused by: org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred calling getter of com.myapp.app.domain.User.id; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.myapp.app.domain.User.id
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy29.updateEvent(Unknown Source)
at com.myapp.app.jobs.EventProcessingJob.doInSession(EventProcessingJob.java:95)
at com.myapp.app.jobs.OpenSessionInViewJob.doExecute(OpenSessionInViewJob.java:47)
at com.myapp.app.jobs.AbstractSpringEnabledJob.execute(AbstractSpringEnabledJob.java:24)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
... 1 more
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.myapp.User.id
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:198)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:230)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3852)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3560)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:243)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:449)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:280)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:290)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:668)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3380)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:520)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:230)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
... 14 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4a997131
at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:172)
... 34 more
My hibernate mappings are:
Code:
Event.hbm.xml:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="com.myapp.app.domain.event.Event" table="EVENTS" discriminator-value="0">
<id name="id" column="EVENT_ID" type="java.lang.Integer">
<generator class="native"/>
</id>
<discriminator column="EVENT_TYPE" type="int"/>
<property name="eventName" column="EVENT_NAME" not-null="true" unique="true"/>
<property name="lastFiredDateTime" column="LAST_FIRED_DATE_TIME" not-null="false"/>
...
...
<many-to-one name="owner" class="com.myapp.app.domain.User" column="OWNER" lazy="no-proxy"/>
<subclass name="com.myapp.app.domain.event.DatabaseEvent" discriminator-value="3">
<property name="queries" column="QUERY"/>
</subclass>
<subclass name="com.myapp.app.domain.event.FileEvent" discriminator-value="2">
<property name="fileName" column="FILE_NAME"/>
</subclass>
<subclass name="com.myapp.app.domain.event.ManualEvent" discriminator-value="4">
</subclass>
</class>
</hibernate-mapping>
User.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="com.myapp.app.domain.User" table="USER">
<id name="id" column="USER_ID" type="java.lang.Integer">
<generator class="native"/>
</id>
<property name="name" column="NAME" not-null="true" unique="true"/>
...
... More columns mapped....
</class>
</hibernate-mapping>
The error occurs when updating the Event record during background activities to set the lastFiredTime field (part of a scheduled Quartz job). We can have up to 20 activities happening in parallel (but they all run for varying amounts of time) and the User may be the same user for jobs.
The intermittent nature of this is really confusing me, the number of failures each day varies as is which of them fail. Can anyone shed some light?