private static long getMaxBidId ( Client client ) { long currentMaxBidId = 0 ; try { VoltTable vt = client . callProcedure ( "@AdHoc" , "select max(id) from bids" ) . getResults ( ) [ 0 ] ; vt . advanceRow ( ) ; currentMaxBidId = vt . getLong ( 0 ) ; if ( vt . wasNull ( ) ) { currentMaxBidId = 0 ; } } catch ( IOException | ProcCallException e ) { e . printStackTrace ( ) ; } return currentMaxBidId ; }
Find the current highest bid id in the bids table . We ll start generating new bids at this number plus one .