Example 12 - Loading Bid from DB
    private void LoadState( Connection dbConn, Statement dbStmt, BidPK pk )
    throws ObjectNotFoundException, SQLException
    {
        String selSpec = "select itemKey1,itemKey2,amount,bidTimeHi,bidTimeLo ";
        selSpec += "from BidTbl where ";
        selSpec += "ownerId=" + SQLForm( pk.fOwnerId ) + " AND ";
        selSpec += "ownedId=" + SQLForm( pk.fOwnedId );
        ResultSet rs = dbStmt.executeQuery( selSpec );
        if ( !rs.next() ) throw new NoSuchEntityException();
        fOwnerId = pk.fOwnerId;
        fOwnedId = pk.fOwnedId;
        fItemKey1 = rs.getString( "itemKey1" );
        fItemKey2 = rs.getInt( "itemKey2" );
        fAmount = rs.getInt( "amount" );
        long bHi = rs.getInt( "bidTimeHi" );
        bHi &= 0xffffffffL;
        bHi <<= 32;
        long bLo = rs.getInt( "bidTimeLo");
        bLo &= 0xffffffffL;
        fBidTime = bHi | bLo;
        fDirty = false;
    }
            

Next Slide >>