I'm using hibernate 2.1 in the context of JTA transactions.  I've enabled optimistic locking by timestamp.  If I use the following jag of code to save, then I get stale object exceptions on subsequent saves in later transactions.
Code:
    session = factory.openSession();
    tx = session.beginTransaction();
    session.save(order);
    session.flush();
    tx.commit();
    session.close();
However, when I evict and reload subsequent saves occur without error.
Code:
    session = factory.openSession();
    tx = session.beginTransaction();
    session.save(order);
    session.flush();
    session.evict(order);
    order = (Order) session.load(order.getClass(), new Long(order.getWebOrderId()));
    tx.commit();
    session.close();
I hardly think that the evict and reload should be required.  The timestamps seem to be getting set in both the entities and the database.  Anyone have any ideas what I may be doing wrong?