diff --git a/api/src/org/labkey/api/data/DbScope.java b/api/src/org/labkey/api/data/DbScope.java index 12f7fe86acc..2816a90108b 100644 --- a/api/src/org/labkey/api/data/DbScope.java +++ b/api/src/org/labkey/api/data/DbScope.java @@ -709,7 +709,9 @@ public Transaction ensureTransaction(TransactionKind transactionKind, Lock... lo } /** - * Starts a new transaction using a new Connection. + * Starts a new transaction using a new Connection. Most callers should use ensureTransaction() to join an existing + * transaction in the same database. + * * The preferred usage pattern is: *
      *     try (DbScope.Transaction transaction = scope.beginTransaction()) {
@@ -731,7 +733,9 @@ public Transaction beginTransaction(Lock... locks)
     }
 
     /**
-     * Starts a new transaction using a new Connection.
+     * Starts a new transaction using a new Connection. Most callers should use ensureTransaction() to join an existing
+     * transaction in the same database.
+     *
      * The preferred usage pattern is:
      * 
      *     try (DbScope.Transaction transaction = scope.beginTransaction()) {
diff --git a/api/src/org/labkey/api/security/SecurityManager.java b/api/src/org/labkey/api/security/SecurityManager.java
index c6a31ec0642..95ca2bfe3c4 100644
--- a/api/src/org/labkey/api/security/SecurityManager.java
+++ b/api/src/org/labkey/api/security/SecurityManager.java
@@ -1419,7 +1419,7 @@ static void deleteGroup(int groupId)
                 groupId == Group.groupDevelopers)
             throw new IllegalArgumentException("The global groups cannot be deleted.");
 
-        try (Transaction transaction = core.getScope().beginTransaction())
+        try (Transaction transaction = core.getScope().ensureTransaction())
         {
             Group group = getGroup(groupId);
             if (null == group)
@@ -1516,7 +1516,7 @@ public static void deleteMembers(Group group, Collection membersT
             }
             core.getSqlDialect().appendInClauseSql(sql, userIds);
 
-            try (Transaction transaction = core.getScope().beginTransaction())
+            try (Transaction transaction = core.getScope().ensureTransaction())
             {
                 new SqlExecutor(core.getSchema()).execute(sql);
 
diff --git a/api/src/org/labkey/api/security/UserManager.java b/api/src/org/labkey/api/security/UserManager.java
index 9202290e539..4a8286b3b81 100644
--- a/api/src/org/labkey/api/security/UserManager.java
+++ b/api/src/org/labkey/api/security/UserManager.java
@@ -948,7 +948,7 @@ public static void deleteUser(int userId) throws UserManagementException
                 throw new RuntimeException(first);
         }
 
-        try (Transaction transaction = CORE.getScope().beginTransaction())
+        try (Transaction transaction = CORE.getScope().ensureTransaction())
         {
             boolean needToEnsureRootAdmins = SecurityManager.isRootAdmin(user);
 
@@ -1017,7 +1017,7 @@ public static void setUserActive(User currentUser, User userToAdjust, boolean ac
                 throw new RuntimeException(first);
         }
 
-        try (Transaction transaction = CoreSchema.getInstance().getScope().beginTransaction())
+        try (Transaction transaction = CoreSchema.getInstance().getScope().ensureTransaction())
         {
             Table.update(currentUser, CoreSchema.getInstance().getTableInfoPrincipals(),
                     Collections.singletonMap("Active", active), userId);