Skip to content

Commit

Permalink
Fix EntityManager Count methods (one would throw exception, one is ve…
Browse files Browse the repository at this point in the history
…rbose)
  • Loading branch information
fracture91 committed Mar 10, 2013
1 parent 6d018ce commit 1b60819
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void deleteAll(Session s) throws WPISuiteException {
public int Count() {
// TODO: there must be a faster way to do this with db4o
// note that this is not project-specific - ids are unique across projects
return db.retrieveAll(new Defect()).toArray(new Defect[0]).length;
return db.retrieveAll(new Defect()).size();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ public void save(Session s, PostBoardMessage model)
@Override
public boolean deleteEntity(Session s, String id) throws WPISuiteException {

// This module does not all PostBoardMessages to be deleted, so throw
// an exception
// This module does not allow PostBoardMessages to be deleted, so throw an exception
throw new WPISuiteException();
}

Expand All @@ -145,8 +144,7 @@ public boolean deleteEntity(Session s, String id) throws WPISuiteException {
@Override
public void deleteAll(Session s) throws WPISuiteException {

// This module does not all PostBoardMessages to be deleted, so throw
// an exception
// This module does not allow PostBoardMessages to be deleted, so throw an exception
throw new WPISuiteException();
}

Expand All @@ -156,7 +154,7 @@ public void deleteAll(Session s) throws WPISuiteException {
@Override
public int Count() throws WPISuiteException {
// Return the number of PostBoardMessages currently in the database
return getAll(null).length;
return db.retrieveAll(new PostBoardMessage(null)).size();
}

@Override
Expand Down

0 comments on commit 1b60819

Please sign in to comment.