@Override
    public long count() throws PersistenceException {
        logger.debug("enter - count()");
        try {
            Transaction xaction = Transaction.getInstance(true);
            Counter counter = getCounter(null);

            try {
                Map<String,Object> results;
                long count;

                results = xaction.execute(counter, new HashMap<String,Object>(0), readDataSource);
                count = ((Number)results.get("count")).longValue();
                xaction.commit();
                return count;
            }
            finally {
                xaction.rollback();
            }
        }
        finally {
            logger.debug("exit - count()");
        }
    }
@ Override public long count ( ) throws PersistenceException { logger . debug ( "enter - count()" ) ; try { Transaction xaction = Transaction . getInstance ( true ) ; Counter counter = getCounter ( null ) ; try { Map < String , Object > results ; long count ; results = xaction . execute ( counter , new HashMap < String , Object > ( 0 ) , readDataSource ) ; count = ( ( Number ) results . get ( "count" ) ) . longValue ( ) ; xaction . commit ( ) ; return count ; } finally { xaction . rollback ( ) ; } } finally { logger . debug ( "exit - count()" ) ; } }
Counts the total number of objects governed by this factory in the database.
@return the number of objects in the database
@throws PersistenceException an error occurred counting the elements in the database