-->
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.  [ 3 posts ] 
Author Message
 Post subject: IInterceptor and OnLoad
PostPosted: Wed Mar 11, 2009 5:12 pm 
Newbie

Joined: Thu Jan 29, 2009 2:08 pm
Posts: 2
I have implemented an IInterceptor in our repository, because have some processing that needs to take place after an object is loaded. If a transaction is not involved, OnLoad is called, however, NHibernate has not yet populated the object. I was not expecting this behavior, since everything I've read about IInterceptor indicates that OnLoad is called after NHibernate has already loaded the object.

Now, if I use a transaction, after the transaction is complete, I have a fully populated object, but we don't always use transactions.

Am I flat out misunderstanding how this works, or is there another reason why OnLoad is being called, when the object has not actually been loaded by NHibernate?

If you need any more details, let me know, but hopefully I've explained the problem well enough.

Thank you,

D.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 6:47 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
That's the way it works. I don't like it either. If you use NH 2.0, you better go with the new event system. If you stick with 1.2 you can implement ILifecycle on your objects. ILifecycle.OnLoad is called after the object is hydrated.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 10:35 am 
Newbie

Joined: Thu Jan 29, 2009 2:08 pm
Posts: 2
Thank you for your reply.

I will look into moving to 2.0 today, because the changes I'm attempting to implement are vital to the success of our product. So a workable solution must be found.

Thank you again,
D.


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

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.