I think this is an easy question, but my googling is weak on this.
I had the problem described in the following link with regard to a generated ID and cascading:
https://www.hibernate.org/hib_docs/nhibernate/html/example-parentchild.html (towards the bottom)
I fixed it using their suggested method of an Interceptor. Everything appears to be working, so I am happy.
That said, I have no idea what the significance of the return value is from methods such as:
public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types)
{
if (entity is Persistent) ((Persistent)entity).OnLoad();
return false;
}
public override bool OnSave(object entity, object id, object[] state, string[] propertyNames, IType[] types)
{
if (entity is Persistent) ((Persistent)entity).OnSave();
return false;
}
In both cases false is returned.
When I google about NHibernate Interceptors I see plenty of examples of how to write one. Some instead return true (http://www.lostechies.com/blogs/rhouston/archive/2008/03/27/creating-a-timestamp-interceptor-in-nhibernate.aspx). I have no idea what the difference is here. My code is working, but Interceptors seem useful to me so I'd like to have a better understanding.
I believe the return value should indicate if the state parameter has been changed in the interceptor method. You're right - it's a tough one to google at the moment - the NHibernate site moved recently and google doesn't seem to find as much useful info as it used to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With