Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I am using hibernate with spring. This error "ORA-22922: nonexistent LOB value" is thrown intermittently while updating a table that has a CLOB column.
When I looked in other database forums (
http://www.error-code.org.uk/view.asp?c ... A&ec=22922), I found that this error is thrown by database when the LOB column does not have the proper handle while updating that record.. To solve this error, that record needs to be retrieved using "SELECT" statement before updating that record. This retrieval will update the LOB column's handle.
In the below code, ContentSet is the model that need to be updated. Before updating, I am doing a retrieve. But still I am getting this exception sometimes. How do we make sure that it does the database retrieve before updating?
ContentSet retrievedContentSet = (ContentSet) getHibernateTemplate().get(ContentSet.class, contentSetId, LockMode.UPGRADE);
retrievedContentSet.setCsStatus(status);
getHibernateTemplate().save(retrievedContentSet);
Please advise me if any body has any idea about this problem...
Hibernate version: Hibernate 3.0
Mapping documents: http://www.error-code.org.uk/view.asp?c ... A&ec=22922
Code between sessionFactory.openSession() and session.close():
ContentSet retrievedContentSet = (ContentSet) getHibernateTemplate().get(ContentSet.class, contentSetId, LockMode.UPGRADE);
retrievedContentSet.setCsStatus(status);
getHibernateTemplate().save(retrievedContentSet);
Full stack trace of any exception that occurs:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Could not execute JDBC batch update; uncategorized SQLException for SQL [update CST_CONTENT_SET set DESCRIPTION=?, RECIPE=?, LAST_MODIFIED=?, CS_STATUS=?, UPDATE_MODE=?, CRON_EXPRESSION=?, MCI_LOAD_STATUS=? where ID=?]; SQL state [99999]; error code [22922]; ORA-22922: nonexistent LOB value
; nested exception is java.sql.BatchUpdateException: ORA-22922: nonexistent LOB value
: Hibernate operation: Could not execute JDBC batch update; uncategorized SQLException for SQL [update CST_CONTENT_SET set DESCRIPTION=?, RECIPE=?, LAST_MODIFIED=?, CS_STATUS=?, UPDATE_MODE=?, CRON_EXPRESSION=?, MCI_LOAD_STATUS=? where ID=?]; SQL state [99999]; error code [22922]; ORA-22922: nonexistent LOB value
; nested exception is java.sql.BatchUpdateException: ORA-22922: nonexistent LOB value
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(Ljava/lang/String;Ljava/lang/String;Ljava/sql/SQLException;)Lorg/springframework/dao/DataAccessException;(SQLStateSQLExceptionTranslator.java:120)
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(Ljava/lang/String;Ljava/lang/String;Ljava/sql/SQLException;)Lorg/springframework/dao/DataAccessException;(SQLErrorCodeSQLExceptionTranslator.java:276)
org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(Lorg/hibernate/JDBCException;)Lorg/springframework/dao/DataAccessException;(HibernateAccessor.java:424)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(Lorg/hibernate/HibernateException;)Lorg/springframework/dao/DataAccessException;(HibernateAccessor.java:411)
com.gale.cs.workflow.contentset.biz.service.impl.ContentSetCatalogServiceImpl.insertOrUpdateContentSet(Lcom/gale/cs/workflow/contentset/model/ContentSet;Ljava/util/List;Ljava/util/Map;)V(Optimized Method)
jrockit.reflect.NativeMethodInvoker.invoke0(Ljava/lang/Object;ILjava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
jrockit.reflect.NativeMethodInvoker.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Optimized Method)
java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Optimized Method)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;(AopUtils.java:318)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint()Ljava/lang/Object;(ReflectiveMethodInvocation.java:203)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed()Ljava/lang/Object;(ReflectiveMethodInvocation.java:162)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Lorg/aopalliance/intercept/MethodInvocation;)Ljava/lang/Object;(TransactionInterceptor.java:107)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed()Ljava/lang/Object;(ReflectiveMethodInvocation.java:185)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;(JdkDynamicAopProxy.java:209)
$Proxy52.insertOrUpdateContentSet(Lcom/gale/cs/workflow/contentset/model/ContentSet;Ljava/util/List;Ljava/util/Map;)V(Unknown Source)
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
update CST_CONTENT_SET set DESCRIPTION=?, RECIPE=?, LAST_MODIFIED=?, CS_STATUS=?, UPDATE_MODE=?, CRON_EXPRESSION=?, MCI_LOAD_STATUS=? where ID=?
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html