Behind the Blackboard! Public API GroupMembershipDbPersister does not work the same way as Private persistGroupAndEnrol - Behind the Blackboard Skip Navigation
Download PDF  Icon Download PDF    Print article

Public API GroupMembershipDbPersister does not work the same way as Private persistGroupAndEnrol

Date Published: Jul 04,2019

CategoryPlanned First Fix Release:Functioning as Designed; Product:Extensions; Version:Learn 9.1 Q4 2019 (3800.0.0),Learn 9.1 Q4 2018 (3500.0.0),Learn 9.1 Q2 2019 (3700.0.0),SaaS
Article No.: 000055892
Blackboard Learn
Service Pack(s):
Learn 9.1 Q4 2019 (3800.0.0), Learn 9.1 Q4 2018 (3500.0.0), Learn 9.1 Q2 2019 (3700.0.0), SaaS
If there are two Groups in the same Group set, Group A and Group B, when a Student is moved from Group A to Group B using persistGroupAndEnroll(), the Student is automatically removed from Group A without having to specify this. Using the public API, this does not happen, and the Student remains in Group A, while also being added to Group B, resulting in an invalid state for that Group set.
Steps to Repeat:
  1. Create a Course and note Pk1
  2. Create a User and note PK1 
  3. Enroll as Student in above Course
  4. Create a Groupset > Manual Enroll > Note the groups pk1’s
  5. Create a B2 to enroll this User onto the first Group in the set
  6.  Use the pk1’s above to generate Id’s and call the addUserToGroup method below:
Id courseID = (Id.+generateId++(+*+new+* +DataType(*+class+*+), 28))+;
Id userId = (Id.+generateId++(+*+new+* +DataType(*+class+*+), 172))+;
Id groupId = (Id.+generateId++(Group.+*_+DATA_TYPE+_*+, 252))+;
System.*_out_*.println("Add to group");
addUserToGroup_(courseID,groupId, userId );


public static boolean addUserToGroup(Id courseId, Id groupId, Id userId)


                               System.out.println("adding user to group: courseId " + courseId.toExternalString() + " " + groupId.toExternalString() + " " + userId.toExternalString());
                               try {
                                              BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
                                              GroupMembershipDbPersister groupMembershipDbPersister = (GroupMembershipDbPersister)bbPm.getPersister(GroupMembershipDbPersister.TYPE);
                                              CourseMembershipDbLoader courseMembershipDbLoader = (CourseMembershipDbLoader)bbPm.getLoader(CourseMembershipDbLoader.TYPE);
                                              CourseMembership courseMembership = courseMembershipDbLoader.loadByCourseAndUserId(courseId,userId);
                                              GroupMembership groupMembership = new GroupMembership();
                                              return true;

                               } catch (Exception ex) {



                               return false;
  1. The User will be enrolled in the first Group 
  2. Change the Group POK1 to another Group in the set and run

Observed Behavior: 
The User will end up on both Groups

Expected Behavior:
The API will remove the User form the other Group like the private persistGroupAndEnrol does

Target Release:

Functioning as Designed

Patch Available:


The information contained in the Knowledge Base was written and/or verified by Blackboard Support. It is approved for client use. Nothing in the Knowledge Base shall be deemed to modify your license in any way to any Blackboard product. If you have comments, questions, or concerns, please send an email to © 2022 Blackboard Inc. All rights reserved