AnsweredAssumed Answered

Using Lineitem class

Question asked by stephen.lord on Dec 5, 2016

I'm working on a piece of code that will create a new column in the Blackboard Grade Centre, using the Lineitem class. The code below is not working:

    try{

            Connection con = BbServer.getDbConnection();  //get our DB connection

            BbPersistenceManager bbPm = BbServiceManager.getPersistenceService().getDbPersistenceManager();

            CourseDbLoader cLoader = (CourseDbLoader) bbPm.getLoader(CourseDbLoader.TYPE);

          

            Course crs = cLoader.loadByCourseId("515009_2017_01", con, true);

            Id crsId = crs.getId();

 

            Lineitem finalcol = new Lineitem();

            finalcol.setCourseId(crsId);

            finalcol.setName("ArionGR");

            finalcol.setPointsPossible(100f);

 

            LineitemDbPersister linePersister = (LineitemDbPersister) bbPm.getPersister(LineitemDbPersister.TYPE);

            linePersister.persist(finalcol);    

    }

    catch statements here.....

 

Throws an Exception with the message: "blackboard.persist.KeyNotFoundException: The specified object was not found"

Grateful for any suggestions....

Outcomes