* @return true if the update was successful, false if it failed due to the stat being
* simultaneously modified by another database client.
*/
protected boolean updateStat (int playerId, final Stat stat, boolean forceWrite)
{
ByteArrayOutInputStream out = new ByteArrayOutInputStream();
try {
stat.persistTo(new ObjectOutputStream(out), this);
} catch (IOException ioe) {
throw new DatabaseException("Error serializing stat " + stat, ioe);
}
byte[] data = out.toByteArray();
byte nextModCount = (byte)((stat.getModCount() + 1) % Byte.MAX_VALUE);
Key<StatRecord> key = StatRecord.getKey(playerId, stat.getCode());
// update the row in the database only if it has the expected modCount
int numRows = updatePartial(