Ok, thanks, that makes sense. When I said "safely serialized", I meant that any changes to the objects in the web tier would not result in the web tier trying to make database update or select calls.
So for example:
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
AuctionItem item = (AuctionItem) session.get(ActionItem.class, itemId);
tx.commit(); // <- at this point Item is effectively "detached "
session.close(); // so any set calls on item after this point are not persisted
// until you do the following
...
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
session.update(item);
tx.commit();
session.close();
And if you allow the EJB to handle transactions instead, then an object becomes detached as soon as the EJB method call completes and the object is returned to the caller.
If this is the case, then I just may use the hiberate objects as my value objects (DTOs) for the web tier. I am sure there are arguments that this could couple the data domain too closely to the web tier, but in my experience you typically have to change both anyway, and the design of the hibernate objects could reflect a less data centric view of the data as well.
Tim
|