Hibernate version:
2.1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.sony.model.JobsContent" table="jobs_content" batch-size="30">
<cache usage="read-write"/>
<id name="id" column="H1" unsaved-value="0">
<generator class="sequence">
<param name="sequence">HIBERNATE1</param>
</generator>
</id>
<property name="jobId" column="JOB_ID" not-null="true" />
<property name="tagId" column="TAG_ID" not-null="true"/>
<property name="value" column="VALUE" type="com.sony.StringClobType2"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
session = sessionFactory.openSession(conn);
...yadda...
finally{
session.close()
}
Full stack trace of any exception that occurs:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sunnyside.ThreadManager.tunnelException(ThreadManager.java:113)
at com.sony.sunnyside.ThreadManager.execute(ThreadManager.java:41)
at com.sony.sunnyside.ActionCallBack.execute(ActionCallBack.java:20)
at com.sony.sunnyside.Dispatcher.handleRequest(Dispatcher.java:85)
at com.sony.sunnyside.Dispatcher.doGet(Dispatcher.java:59)
at com.sony.sunnyside.Dispatcher.doPost(Dispatcher.java:106)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:31)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
... 1 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:31)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
... 5 more
Caused by: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:288)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
... 9 more
Caused by: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
... 10 more
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
... 17 more
----------------------------------------------------------
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:31)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:31)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
... 5 more
Caused by: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:288)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
... 9 more
Caused by: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
... 10 more
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
... 17 more
----------------------------------------------------------
java.lang.RuntimeException: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:31)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:288)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
... 9 more
Caused by: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
... 10 more
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
... 17 more
----------------------------------------------------------
java.lang.RuntimeException: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:288)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
at java.lang.Thread.run(Thread.java:534)
Caused by: net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
... 10 more
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
... 17 more
----------------------------------------------------------
net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
... 17 more
----------------------------------------------------------
java.sql.BatchUpdateException: ORA-00001: unique constraint (SPCDEVODS.SYS_C008588) violated
at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.sony.sandbar.HermesSandbar$10.trans(HermesSandbar.java:284)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.sandbar.HermesSandbar.getATag(HermesSandbar.java:297)
at com.sony.content.data_access.TagsConcern.save(TagsConcern.java:138)
at com.sony.content.HermesContentController$1.trans(HermesContentController.java:278)
at com.sony.sandbar.TransactionBase.execute(TransactionBase.java:27)
at com.sony.content.HermesContentController.save(HermesContentController.java:287)
at com.sony.content.display.ContentSummary$5.execute(ContentSummary.java:197)
at com.sony.sunnyside.ActionCallBack$1.run(ActionCallBack.java:23)
at com.sony.sunnyside.ThreadManager$1.run(ThreadManager.java:23)
at java.lang.Thread.run(Thread.java:534)
Name and version of the database you are using:
Oracle 8i
The generated SQL (show_sql=true):
(except)
Hibernate: select tags0_.TAG_ID as TAG_ID, tags0_.DEFAULT_VALUE as DEFAULT_2_, tags0_.STATUS as STATUS, tags0_.TYPE as TYPE, tags0_.HTMLEDIT as HTMLEDIT, tags0_.CSS_BASE as CSS_BASE, tags0_.HTMLEDIT_DEFAULT as HTMLEDIT7_ from tags tags0_ where (tags0_.TAG_ID=? )
Hibernate: select jobstempla0_.H1 as H1, jobstempla0_.TEMPLATE_ID as TEMPLATE2_, jobstempla0_.JOB_ID as JOB_ID, jobstempla0_.VALUE as VALUE, jobstempla0_.FORMAT as FORMAT, jobstempla0_.TYPE as TYPE from jobs_templates jobstempla0_ where (jobstempla0_.JOB_ID=? )and(jobstempla0_.FORMAT=? )and(jobstempla0_.TYPE=? )
Hibernate: select jobstempla0_.H1 as H1, jobstempla0_.TEMPLATE_ID as TEMPLATE2_, jobstempla0_.JOB_ID as JOB_ID, jobstempla0_.VALUE as VALUE, jobstempla0_.FORMAT as FORMAT, jobstempla0_.TYPE as TYPE from jobs_templates jobstempla0_ where (jobstempla0_.JOB_ID=? )and(jobstempla0_.FORMAT=? )and(jobstempla0_.TYPE=? )
Hibernate: select language0_.LANGUAGE_ID as x0_0_, language0_.LANGUAGE_NAME as x1_0_ from languages language0_ order by language0_.LANGUAGE_NAME
Hibernate: select jobsconten0_.H1 as H1, jobsconten0_.JOB_ID as JOB_ID, jobsconten0_.TAG_ID as TAG_ID, jobsconten0_.VALUE as VALUE from jobs_content jobsconten0_ where (jobsconten0_.JOB_ID=? )and(jobsconten0_.TAG_ID=? )
Hibernate: update jobs set LANGUAGE_ID=?, STATUS=?, COMPANY_ID=?, USERNAME=?, LAST_USER=?, PREVIEW_EMAIL_ADDRESS=?, CAMPAIGN_CODE=? where JOB_ID=?
Hibernate: update jobs_content set JOB_ID=?, TAG_ID=?, VALUE=? where H1=?
Debug level Hibernate log excerpt:
Don't know what this is.
---------------------------------------------------------------------
Ok, I am about as frustrated as a person can get. All I am doing is a simple insert into my database. If the row exists, I expect Hibernate to update it. Normal stuff.
This may be related to my imperfect understanding of transaction handling in Hibernate. In this particular case, before I attempt to save() into jobs_content, I read the row first to make sure it is known to me. Oddly, the problems happens when I try to read a row. Perhaps it has something to do with a row I have already batched up.
I absolutely have no idea why this should be failing. All the rows I am save()ing should already exist in the database table. So it should be updating in all cases - and with no inserts, I don't expect a dup key failure. I singled stepped through my code to make sure the keys (job_id + tag_id) are correct.
How do I proceed?
|