Index: app/business/src/java/org/sakaiproject/tool/gradebook/business/impl/GradebookManagerHibernateImpl.java =================================================================== --- app/business/src/java/org/sakaiproject/tool/gradebook/business/impl/GradebookManagerHibernateImpl.java (revision 56658) +++ app/business/src/java/org/sakaiproject/tool/gradebook/business/impl/GradebookManagerHibernateImpl.java (working copy) @@ -959,7 +959,7 @@ public boolean isEnteredAssignmentScores(final Long assignmentId) { HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { - Integer total = (Integer)session.createQuery( + Long total = (Long)session.createQuery( "select count(agr) from AssignmentGradeRecord as agr where agr.gradableObject.id=? and agr.pointsEarned is not null"). setLong(0, assignmentId.longValue()). uniqueResult(); @@ -967,7 +967,7 @@ return total; } }; - return ((Integer)getHibernateTemplate().execute(hc)).intValue() > 0; + return ((Long)getHibernateTemplate().execute(hc)).longValue() > 0; } /** @@ -1878,12 +1878,12 @@ session.evict(spreadsheet); Spreadsheet sptFromDb = (Spreadsheet)session.load(Spreadsheet.class, spreadsheet.getId()); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(spt) from Spreadsheet as spt where spt.name = ? and spt.gradebook = ? and spt.id != ?"). setString(0, spreadsheet.getName()). setEntity(1, spreadsheet.getGradebook()). setLong(2, spreadsheet.getId().longValue()). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple spreadsheets in a gradebook with the same name"); } @@ -1908,11 +1908,11 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(spt) from Spreadsheet as spt where spt.name = ? and spt.gradebook = ? "). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingSpreadsheetNameException("You can not save multiple spreadsheets in a gradebook with the same name"); } @@ -2686,11 +2686,11 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false"). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } @@ -2737,11 +2737,11 @@ public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); Category cat = (Category)session.load(Category.class, categoryId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false"). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } Index: app/standalone-app/pom.xml =================================================================== --- app/standalone-app/pom.xml (revision 56658) +++ app/standalone-app/pom.xml (working copy) @@ -322,7 +322,9 @@ + Index: service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java =================================================================== --- service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java (revision 56658) +++ service/impl/src/java/org/sakaiproject/component/gradebook/BaseHibernateManager.java (working copy) @@ -221,12 +221,12 @@ session.evict(assignment); Assignment asnFromDb = (Assignment)session.load(Assignment.class, assignment.getId()); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false and go.id != ?"). setString(0, assignment.getName()). setEntity(1, assignment.getGradebook()). setLong(2, assignment.getId().longValue()). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } @@ -247,11 +247,11 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false"). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } @@ -324,23 +324,23 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { - Integer total; + Long total; if (studentUids.size() <= MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST) { Query q = session.createQuery( "select count(cgr) from CourseGradeRecord as cgr where cgr.enteredGrade is not null and cgr.gradableObject.gradebook.id=:gradebookId and cgr.studentId in (:studentUids)"); q.setLong("gradebookId", gradebookId.longValue()); q.setParameterList("studentUids", studentUids); - total = (Integer)q.list().get(0); + total = (Long)q.list().get(0); if (log.isInfoEnabled()) log.info("total number of explicitly entered course grade records = " + total); } else { - total = new Integer(0); + total = new Long(0); Query q = session.createQuery( "select cgr.studentId from CourseGradeRecord as cgr where cgr.enteredGrade is not null and cgr.gradableObject.gradebook.id=:gradebookId"); q.setLong("gradebookId", gradebookId.longValue()); for (Iterator iter = q.list().iterator(); iter.hasNext(); ) { String studentId = (String)iter.next(); if (studentUids.contains(studentId)) { - total = new Integer(1); + total = new Long(1); break; } } @@ -348,7 +348,7 @@ return total; } }; - return ((Integer)getHibernateTemplate().execute(hc)).intValue() > 0; + return ((Long)getHibernateTemplate().execute(hc)).longValue() > 0; } public Authn getAuthn() { @@ -386,11 +386,11 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(ca) from Category as ca where ca.name = ? and ca.gradebook = ? and ca.removed=false "). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingCategoryNameException("You can not save multiple catetories in a gradebook with the same name"); } @@ -520,12 +520,12 @@ public Object doInHibernate(Session session) throws HibernateException { session.evict(category); Category persistentCat = (Category)session.load(Category.class, category.getId()); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(ca) from Category as ca where ca.name = ? and ca.gradebook = ? and ca.id != ? and ca.removed=false"). setString(0, category.getName()). setEntity(1, category.getGradebook()). setLong(2, category.getId().longValue()). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingCategoryNameException("You can not save multiple category in a gradebook with the same name"); } @@ -848,11 +848,11 @@ HibernateCallback hc = new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false"). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } @@ -891,11 +891,11 @@ public Object doInHibernate(Session session) throws HibernateException { Gradebook gb = (Gradebook)session.load(Gradebook.class, gradebookId); Category cat = (Category)session.load(Category.class, categoryId); - int numNameConflicts = ((Integer)session.createQuery( + long numNameConflicts = ((Long)session.createQuery( "select count(go) from GradableObject as go where go.name = ? and go.gradebook = ? and go.removed=false"). setString(0, name). setEntity(1, gb). - uniqueResult()).intValue(); + uniqueResult()).longValue(); if(numNameConflicts > 0) { throw new ConflictingAssignmentNameException("You can not save multiple assignments in a gradebook with the same name"); } Index: service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java =================================================================== --- service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java (revision 56658) +++ service/impl/src/java/org/sakaiproject/component/gradebook/GradebookExternalAssessmentServiceImpl.java (working copy) @@ -75,12 +75,12 @@ getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { // Ensure that the externalId is unique within this gradebook - Integer externalIdConflicts = (Integer)session.createQuery( + Long externalIdConflicts = (Long)session.createQuery( "select count(asn) from Assignment as asn where asn.externalId=? and asn.gradebook.uid=?"). setString(0, externalId). setString(1, gradebookUid). uniqueResult(); - if (externalIdConflicts.intValue() > 0) { + if (externalIdConflicts.longValue() > 0) { throw new ConflictingExternalIdException("An external assessment with that ID already exists in gradebook uid=" + gradebookUid); }