code: private void add(SessionImpl session, PlainChangesLog changes) throws SystemException, IllegalStateException,
        RollbackException
     {
        Transaction tx = tm.getTransaction();
        if (tx == null)
        {
           // No active tx so there is no need to register the session
           return;
        }
        // Get the current TransactionContext
        TransactionContext ctx = getOrCreateTransactionContext();
        // Register the tx if it has not been done already
        ctx.registerTransaction(tx);
        // Register the given changes
        ctx.add(session, changes);
     }
docs: Add session to the transaction group.
  
  @param userSession
  SessionImpl, user Session
  @throws SystemException
  @throws RollbackException
  @throws IllegalStateException