Makes sense, thanks Adam Regards Scott
2008/11/14 Adam Heath <[EMAIL PROTECTED]>: > Scott Gray wrote: >> Hi Adam, >> >> I'm no transaction expert but how sure are we that starting a new >> transaction just before each test and rolling it back at the end won't >> work? From what I can gather Derby does actually alter the database >> prior to committing the transaction but it also creates log records >> that allow the changes to undone in case of a rollback. >> >> I just tried it using the JUnitListener class to start and end a >> transaction and I can't see any obvious negative effects (aside from >> tests failing that relied on data created in previous tests). > > The reason that won't work, is that some services are configured to run > in a *separate* transaction, completely separate from the one that is in > the current thread. In those cases, the current transaction is > suspended, then resumed. > > To do the transaction rollback stuff in those cases, becomes rather more > complex. It's just simpler to save the disk files, and revert them all, > between tests. Just need to make certain any background threads are > restarted/shutdown. >