By the way, my idea of unit of work is stealling from your Rhino.Commons. Thank you very much, Ayende. I'm a fan of you. :)
On Mon, Dec 8, 2008 at 1:51 PM, karron <[EMAIL PROTECTED]> wrote: > It seems like the ATM doesn't dispose my resource explicitly . The > dispose method in AbstractTransaction just clear the Resources, > doesn't call the resource's dispose method. And I will dispose my > UnitOfWork when the resource dispose. So in this situation, my > unitofwork don't be disposed, when I use it again, it still try to > persist dirty entity again. I find the problem because when I execute > all of my unit test, one will be failed. But when I only execute it, > it pass. > > On Mon, Dec 8, 2008 at 1:32 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote: >> IIRC, you shouldn't do anything, if the transaction wasn't committed, it >> will be rolled back on dispose. >> >> On Mon, Dec 8, 2008 at 12:28 AM, karron <[EMAIL PROTECTED]> wrote: >>> >>> Thank you very much for your very quick response, Ayende. >>> >>> I set ISession.FlushMode = FlushMode.Commit. So when the transaction >>> commit, my entity will be persisted to db. And before inserting my >>> entity, the validator will check if the entity is valid, it throws an >>> exception. In other words, the validation exceptions are raised at >>> commit. So how to change my codes to avoid this problem? I have no >>> idea about it. Thank you very much. >>> >>> On Mon, Dec 8, 2008 at 1:13 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote: >>> > CommittedResourceException means that you have failed to commit the >>> > transaction so you can't even roll it back. >>> > >>> > On Mon, Dec 8, 2008 at 12:10 AM, karron <[EMAIL PROTECTED]> wrote: >>> >> >>> >> Hi, >>> >> >>> >> I implemented a customer resource from IResource interface, it begins( >>> >> commit, rollback) nhibernate transactions. I also add my customer >>> >> IPreInsertEventListener to nh for validations. When my resource >>> >> commit, the validation listener checks if the entity is valid, if not, >>> >> it throws an exception. And AbstractTransaction catches the exception, >>> >> and wraps it as CommitResourceException, and throws it. >>> >> TransactionInterceptor catches this exception, but it says "// Whoops. >>> >> Special case, let's throw without attempt to rollback anything" ( in >>> >> >>> >> >>> >> D:\Sources\castle\Facilities\AutomaticTransactionManagement\Castle.Facilities.AutomaticTransactionManagement\TransactionInterceptor.cs, >>> >> line 128). I don't know why not rollback the transaction. I don't know >>> >> which is special. Any suggestion? >>> >> >>> >> I haven't used NHIntegrationFacility yet. >>> >> >>> >> Thanks. >>> >> >>> >> -- >>> >> Regards, >>> >> Karron >>> >> >>> >> >>> > >>> > >>> > > >>> > >>> >>> >>> >>> -- >>> Regards, >>> Karron >>> >>> >> >> >> >> >> > > > > -- > Regards, > Karron > -- Regards, Karron --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
