Hello, my comments below.
> -----Original Message----- > From: Michael Wiessler [mailto:[EMAIL PROTECTED] > I've implemented a delte() and several load()-Methods similar to this > save()-Method. > All methods are static. > > What do you thik about this implementation ? I wonder why you want to have such a method, because this way you save each object in a single transaction. Why would you want that? > Would you do it in another way ? the execption handling seems suspicious to me. See below. > Have I overseen any pitfalls ? > -------------- > > public static void save(Object object) throws > PersistenceBrokerException > { > // Get a broker from the Pool > PersistenceBroker pbroker = > PersistenceBrokerFactory.defaultPersistenceBroker(); > if (pbroker.isInTransaction()) // Just to be sure ;) > { > pbroker.abortTransaction(); > } That is dangerous, because if that case happens, this means that there is something else wrong (threading issue, wrong exception handling or the like) so it is safer to terminate with an exception. > catch (TransactionAbortedException taex) > // if not able > to commit > { > pbroker.abortTransaction(); // Start a roll-back When a TransactionAbortedException has been caught, then a subsequent abortTransaction should fail (if I am right). Olli --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
