Code example for BitSet

Methods: get, length, set

0
     * {@inheritDoc} 
     */ 
    public Boolean retrieve(long id, Connection conn)
        throws EntityDoesNotExistException, SQLException 
    { 
        if(cache != null && id < cache.length())
        { 
            if(defined.get((int)id))
            { 
                return cache.get((int)id) ? Boolean.TRUE : Boolean.FALSE;
            } 
        } 
        Statement stmt = conn.createStatement();
        ResultSet rs = null;
        try 
        { 
            rs = stmt.executeQuery(
                "SELECT data FROM "+getTable()+" WHERE data_key = "+id
            ); 
            if(!rs.next())
            { 
                throw new EntityDoesNotExistException("Item #"+id+" does not exist in table "+
                    getTable()); 
            } 
            boolean value = rs.getBoolean(1);
            if(cache != null && id < cache.length())
            { 
                cache.set((int)id, value);
                defined.set((int)id);
            }             
            return value ? Boolean.TRUE : Boolean.FALSE;
        } 
        finally