[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-7017) Envers does not work in case of resource-local transactions and manual session flush mode

Vladimir Velikiy (JIRA) noreply at atlassian.com
Sat Feb 4 08:25:09 EST 2012


    [ https://hibernate.onjira.com/browse/HHH-7017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45368#comment-45368 ] 

Vladimir Velikiy edited comment on HHH-7017 at 2/4/12 7:24 AM:
---------------------------------------------------------------

I attached test case. This file is copy of ManualFlush.java with one change in the hibernate configuration:

    @Override
    public void configure(Ejb3Configuration cfg) {
        super.configure(cfg);
        cfg.setProperty("hibernate.connection.autocommit", "false");
    }

With this change some tests are not passed:

Results :

Failed tests: 
  testRevisionTypes(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)
  testRevisionsCounts(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)
  testHistoryOfId(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)
  testRevisionTypes(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)
  testRevisionsCounts(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)
  testHistoryOfId(org.hibernate.envers.test.integration.flush.ManualFlushAutoCommitDisabled)

      was (Author: vladvel):
    Test case for issue
  
> Envers does not work in case of resource-local transactions and manual session flush mode
> -----------------------------------------------------------------------------------------
>
>                 Key: HHH-7017
>                 URL: https://hibernate.onjira.com/browse/HHH-7017
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.6.9
>         Environment: Hibernate 3.6.9, MySQL 5.1.44-community, mysql-connector-java-5.1.6, Inno DB tables
>            Reporter: Vladimir Velikiy
>            Assignee: Adam Warski
>              Labels: auditing
>         Attachments: ManualFlushAutoCommitDisabled.java
>
>
> When I set a manual hibernate session flush mode envers does not write data in database. With FlushMode.AUTO all works ok. I think the problem in in a method doBeforeTransactionCompletion of the AuditProcess.java:
>       if (FlushMode.isManualFlushMode(session.getFlushMode())) {
>             Session temporarySession = null;
>             try {
>                 temporarySession = session.getFactory().openTemporarySession();
>                 executeInSession(temporarySession);
>                 temporarySession.flush();
>             } finally {
>                 if (temporarySession != null) {
>                     temporarySession.close();
>                 }
>             }
>         } else {
>             executeInSession((Session) session);
>             // Explicity flushing the session, as the auto-flush may have already happened.
>             session.flush();
>         }
> In non-jta environment temporary session connection transaction is not commited.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list