On 10 juil. 2010, at 09:05, Adam Warski wrote: > This, however, as it turns out, causes big problems in a JTA environment > (with resource-local txs all works fine): audit records are sometimes not > written. This is because the before tx completion process is called before tx > synchronizations, and in JTA the auto-flush at the end of a session is done > using a TX synchronization (AbstractEntityManagerImpl:1020). And it doesn't > look like exceptions are eaten when thrown from a synchronization in JTA - > otherwise any exception that occurred during a flush would go unnoticed (and > I know from practice this doesn't happen ;) ).
FYI, HEM does register the flush as a Synchronization operation because flush is conditionally executed (based on the fact that a PC has joined the tx or not). I could try and do the beforeCommit phase as an actionQueue#registerProcess(), but the question is will it fix the problem all the time? Today the impl seems to rely on a List so it's likely to work if the em#joinTransaction call is done before Hibernate Search and Hibernate Envers registrations. Emmanuel _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev