Hibernate Search is affected by this, but I thought the current
problem was due to the fact that work is being executed in another
We were planning to fix it by collecting the underlying exception and
rethrow it to the main thread, or optionally have it logged in case of
but as far as I remember, this was working properly in the pre-3.1
times when Search was depending on Hibernate 3.2.x - I might be wrong.
Emmanuel made a great point in the book about the fact that you
probably don't want to rollback your business operations on the
database in case of indexing failures - I totally agree with that, so
that sets Search in a special corner regarding this.
2010/3/24 Adam Warski <adam(a)warski.org>:
if a transaction synchronization throws an exception, is it only logged, and not thrown
further (see org.hibernate.transaction.JDBCTransaction, line 273). Is there some reason
As Envers uses tx synchronizations quite extensively, when an exception is thrown in the
synchronization, I roll back the transaction manually. So, no data is persisted (which is
the desired behavior), but the client isn't notified in any way that something went
wrong; for the client, the operation behaves as if the tx commited successfully.
I suspect that maybe some applications rely on the fact that the exception is eaten and
not re-thrown. If there are no contra-arguments to throw the exceptions, maybe a good
solution would be to re-throw the exception is the transaction is already marked for
rollback? Or if it was marked for rollback in the synchronization?
The related JIRA issues are:
By the way, how does Hibernate Search deal with such situations? I looked at
PostTransactionWorkQueueSynchronization, and it seems that it's possible that the
transaction commits, but the data isn't indexed properly, if the
queueingProcessor.performWorks throws an exception?
hibernate-dev mailing list