-->
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.  [ 2 posts ] 
Author Message
 Post subject: IInterceptor OnSave?
PostPosted: Tue Apr 24, 2007 8:11 pm 
Beginner
Beginner

Joined: Wed Mar 14, 2007 12:35 pm
Posts: 24
Hibernate version: TRUNK

It says that OnSave is fired PRIOR to saving the object. However, this doesn't appear to be the case when using identity based IDs. My question is if this is a bug or if I'm misreading when OnSave is really fired?

SessionImpl.cs (starting at line 908)
Code:
         // NH-962: This was originally done before many-to-one cascades.
         // Execute all delayed inserts (including those for entities saved due to cascading above)
         if (useIdentityColumn)
         {
            ExecuteInserts();
         }

         object[] values = persister.GetPropertyValues(theObj);
         IType[] types = persister.PropertyTypes;

         bool substitute = false;
         if (!replicate)
         {
            substitute = interceptor.OnSave(theObj, id, values, persister.PropertyNames, types);

            // Keep the existing version number in the case of replicate!
            if (persister.IsVersioned)
            {
               // IsUnsavedVersion bit below is NHibernate-specific
               substitute = Versioning.SeedVersion(
                               values, persister.VersionProperty, persister.VersionType, persister.IsUnsavedVersion(values), this
                               ) || substitute;
            }
         }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 3:29 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
If ExecuteInserts is what bothers you, the inserts executed do not include the entity being inserted.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.