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: Is there an event like OnAfterLoad Entity
PostPosted: Tue Mar 02, 2010 9:45 am 
Newbie

Joined: Wed Oct 15, 2008 11:57 am
Posts: 3
Hi !

I'm searching for some kind of event or interceptor method where I can manipulate
an entity after it was loaded.

I tried EmptyInterceptor, but the OnLoad Method is called before Load.

thanks for your help

robert


Top
 Profile  
 
 Post subject: Re: Is there an event like OnAfterLoad Entity
PostPosted: Tue Mar 02, 2010 10:16 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
In Hibernate there exists the @PostLoad annotation.
But I do not know if there exists similar on NHibernate.


Top
 Profile  
 
 Post subject: Re: Is there an event like OnAfterLoad Entity
PostPosted: Tue Mar 02, 2010 10:41 am 
Newbie

Joined: Wed Oct 15, 2008 11:57 am
Posts: 3
thanks to pb00067 I found something like this.

Code:
<listener class="MyAssemby.PostLoadEventListener, MyAssemby" type="post-load"/>

public class PostLoadEventListener : IPostLoadEventListener
{
     public void OnPostLoad(PostLoadEvent @event)
     {   
          EntityEntry entry = @event.Session.PersistenceContext.GetEntry(@event.Entity);   
          entry.BackSetStatus(Status.ReadOnly);
     }
}


Looks like this is a feature in NH 2.0

thanks pb00067, I'll check this out.


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.