-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Callback for OnSave_Complete on an object
PostPosted: Mon Nov 13, 2006 1:01 pm 
Newbie

Joined: Mon Nov 13, 2006 12:43 pm
Posts: 11
Location: US
Hi all!

I recently started investigating NHibernate for use at our company, and find it extremely helpful. It tremendously speeds up the development timeline.

However, I have a question regarding the lifetime of an object. I have read other threads on the topic, and agree that I find IValidate somewhat unusable, because I don't know when and how many times the call to Validate() will be made. So, for now, I have put my Business Logic/Validation code in ILifecycle.OnSave(ISession) and ILifecycle.OnUpdate(ISession) callbacks. This works pretty well.

However, I want to make some updates to the object when the Save() or Update() is done! I would be really-really cool if ILifecycle offered "Post" events, and not just "Pre" events. In other words, it offered 8 methods:

Code:
LifecycleVeto OnDelete(...) //Called before an object is deleted
void OnDelete_Complete(...) // Called when an object has been deleted!

void OnLoad(...) // Before Loading
void OnLoad_Complete(...) // After Loading


(you get the idea).

QUESTION: With the current NHibernate, how do I achieve the equivalent of OnSave_Complete() callback??

(What I want to do is make some changes in the system based on identity generated Primary Key. I don't even mind updating NHibernate code and building it myself, but could someone point me to the right direction?).

I looked into "IInterceptor" interface as well. I don't want to override the default implementation of FindDirty(..), IsUnsaved(..) etc, so, I am unable to use the "IInterceptor" api as well at the moment.

Thanks for your help,
Desiguy

{btw: I am using NHibernate 1.2.0 Beta 2 against SQL Server 2005.}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.