I've thought about this issue, but I feel I'm a bit stuck. So any feedback on some thoughts would be much appreciated.
My idea was to represent the operations in form of org.hibernate.ogm.dialect.batch.Operation objects (the types such as UpdateTupleOperation should be moved to another package in this case of course). In case an error occurs during flush/commit, we could present a list of the previously executed operations to the client.
How would we do this though? Most likely we'd deal with an exception in this case; Should we catch every exception in a central place and wrap it into another exception which provides access to this list? Or should we offer a method on OgmSession which returns the executed operations of the current flush cycle and can be invoked by clients in case any exception hits them (or, whenever they like to)?
Another problem is batched operations; At least with the current implementation for MongoDB I think we e.g. cannot tell which operations of a batched update succeeded and which not. This may be possible with the bulk operation feature new in MongoDB 2.6, though.
|