From: <leg...@at...> - 2003-07-11 19:09:43
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-185 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-185 Summary: flush() does not cleanup after a SQLException Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: Dave White Created: Fri, 11 Jul 2003 2:07 PM Updated: Fri, 11 Jul 2003 2:07 PM Description: I have a object mapped with a composite-id. In the database, there is a unique composite index against the columns that make up the composite-id. I've found that when I do the following: try { session.save(foo); // where foo is the object with the composite-id session.flush(); // Do some other work with session } finally { session.flush(); session.close(); } that if a SQLException is thrown in the first session.flush (because the insert statement violated the unique constraint of the index), the second flush throws the same exception. The means that the flush() call doesn't cleanup the "things to be done" in the case that an exception is thrown during the flushing process. Specifically, I found the following in SessionImpl. private void executeAll(Iterator iter) throws SQLException, HibernateException { while ( iter.hasNext() ) { Executable e = (Executable) iter.next(); executions.add(e); e.execute(); iter.remove(); if ( batcher!=null ) batcher.executeBatch(); } } I'm wondering if perhaps it would be better if this was: private void executeAll(Iterator iter) throws SQLException, HibernateException { while ( iter.hasNext() ) { Executable e = (Executable) iter.next(); executions.add(e); try { e.execute(); } finally { iter.remove(); } if ( batcher!=null ) batcher.executeBatch(); } } After making this change in my local source tree, the problem I descrived above was fixed. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |