This content has been marked as final.
Show 1 reply
-
1. Re: Batching, Hibernate Stateless Session & JBoss...
achitre Mar 8, 2006 7:40 PM (in response to achitre)Turns out that this is not really a JBoss issue, but a Hibernate issue. It looks like the 'AbstractBatcher' class in Hibernate is not quite set up correctly to handle batch updates. We changed the following method in this class to fix this issue:
public boolean hasOpenResources() { //return resultSetsToClose.size() > 0 || statementsToClose.size() > 0; return resultSetsToClose.size() > 0 || statementsToClose.size() > 0 || (batchUpdate != null); }
When a connection is closed, this method is used to check if there are any open resources. In batch update mode, Hibernate doesn't use the 'resultSetsToClose' & 'statementsToClose' variables; but uses the 'batchUpdate' variable. As such, this method needs to return 'true' if batch update is in process.
As for, why this worked in Weblogic and not in JBoss, my only explanation is that JBoss does a better job of cleaning resources after the connection is closed than Weblogic does.
It seems like, when a connection is closed, JBoss closes all the associated PreparedStatements; but Weblogic keeps them open. In this particular case, it seems like, Weblogic was re-attaching a connection to the old PreparedStatement.
Hope this all makes sense. In any case, I will post this reply to the Hibernate mailing list; but I thought I should let everyone know that this isn't a JBoss issue.