1

We have recently migrated from JBOSS EAP 6.4 (JEE 6) to JBOSS EAP 7.2 (JEE 8). In the new version of EAP we are facing issues with the CMT transactions. The flush is not working until we explicitly add the method call entityManager.flush().

The same configuration was working fine in the old EAP server. The new version of container is not flushing the SQL queries during the commit of the transaction.

We have setup the following properties in the persistence.xml.

<persistence-unit name="ACCOUNT" transaction-type="JTA">
<property name="hibernate.transaction.flush_before_completion"      value="true" />
<property name="hibernate.transaction.auto_close_session"           value="true" />         
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />

We expect the container to flush the sql queries, we would not want to add the manual flush method calls.

Please help us if anybody went through this kind of issue. How can we fix this in EAP 7.2 server? Thanks for looking into it.

schowla
  • 35
  • 1
  • 5
  • Why have you set this? Flush is done before the transaction commit anyway – Simon Martinelli Jun 20 '19 at 14:39
  • Thanks for your response. We had as it is not recommeded. The same code is working now with out hibernate.transaction.flush_before_completion and – schowla Jun 20 '19 at 17:34
  • 1
    IMHO you don't need any of the properties – Simon Martinelli Jun 20 '19 at 17:39
  • Yeah, the culprit was hibernate.transaction.flush_before_completion=true, it was causing issue with JTA transaction.Thanks again. – schowla Jun 20 '19 at 18:45
  • 1
    Cool. Happy to help. I added my comment as answer and would appreciate if you could accept it as the correct answer. Thank you – Simon Martinelli Jun 20 '19 at 18:52
  • As I mentioned we are using session beans (EJBs), when we don't add flush(), the hibenrate pre-insert, pre-update and pre-delete methods are not being invoked until transaction commit. Is there a way to invoke those listener methods before control goes back to session bean. We do have some generic audit logic in the listener methods. – schowla Jun 20 '19 at 21:29
  • 1
    The entity listener methods are called before or after the SQL statement is executed. You could add an EJB interceptor that calls flush – Simon Martinelli Jun 21 '19 at 05:32

1 Answers1

3

You can remove all properties. They are not necessary

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82