title: Manage invoke from listeners / create history object before transaction end
body: <p>I have a function which update a customer.
  Furthermore, I have a function which creates an Activity (createActivity)
  Now I want to add to the Activity Entity also the reference to my Custom Audit Table (AuditRevision). Therefore, I try to get the last object from the History Entity (= Function: findLastRevisionFromEntity).</p>
  <p>The problem is, that I got the object <strong>before</strong> from the Custom Audit Table because it seems that the creation from the CustomAudit entry is invoked at the whole end from updateCustomer. So, I will e.g. save AuditRevision with ID = 5, but for the current operation it's ID=6.</p>
  <p>Any idea how I can fix this?
  I'm also fine if I call the listener from Envers manually instead of automatically, but how can I do this? How can I invoke the function (public void newRevision(Object revisionEntity)) from the RevisionListener?</p>
  <pre><code>public void updateCustomer(Customer customer){
  
     entityManager.merge(customer);
  
      // Create Activity
      activitiesProcessServiceBean.createActivity(customer,
                      customer.getEmployeeCreatorOrUpdate(),
                      Activities.ActionType.MODIFY.toString());
  }
  
      
  
  
  
   public Activities createActivity(EntityPropertyFinder entityPropertyFinder, Employee employeeCreator,
                  String activityType){
      
              LOGGER.info(&quot;START createActivity&quot;);
      
              Activities newActivities = new Activities();
              
              // AuditRevision
              AuditRevision auditRevision = jpaAuditUtilBean.findLastRevisionFromEntity(entityPropertyFinder.getClass(),
                      entityPropertyFinder.getId());
              newActivities.setAuditRevision(auditRevision);
              
              activitiesService.addActivities(newActivities);
      
              return newActivities;
          }
  
  
  public AuditRevision findLastRevisionFromEntity(Class&lt;? extends EntityPropertyFinder&gt; class1, Long entityId) {
      
              AuditReader auditReader = AuditReaderFactory.get(entityManager);
              Object[] lastRevision = (Object[]) auditReader.createQuery()
                      .forRevisionsOfEntity(class1, false, false)
                      .add(AuditEntity.property(&quot;id&quot;).eq(entityId))
                      .addOrder(AuditEntity.revisionNumber().desc())
                      .setMaxResults(1)
                      .getSingleResult();
              
              if(lastRevision == null)
                  return null;
              
              AuditRevision auditRevision = (AuditRevision) lastRevision[1];
      
              return auditRevision;
          }
  </code></pre>