Thanks for the pointer to the mapping flags.. I see how dynamic-update does what I need it to.
I'm not sure how much work we're talking about to use the interceptor. I guess what I need to do is, when a new entity is created, I need to prevent it from creating anything other than the parent table, and i'm not sure how difficult that would be to accomplish in the interceptor. On Dec 5, 4:59 pm, cws <[email protected]> wrote: > Hello! > > You colud configure NH to only update-insert necessary columns that > have been changed. > Seehttp://nhforge.org/doc/nh/en/index.html#mapping-declaration-class > > In detached scenario when you have a entity not attached to session it > is possible to use select-before-update > see link above as well. > > For the second one > seehttp://nhforge.org/doc/nh/en/index.html#mapping-generated > or you could use the Refresh method of ISession. > > I think you could use the generated attribute for the last as well, > but I am not sure. > There is another option to use a Interceptor to alter the generated > insert statement in runtime. > seehttp://nhforge.org/doc/nh/en/index.html#manipulatingdata-interceptors > > On Dec 5, 8:20 pm, Erik Wilson <[email protected]> wrote: > > > > > Hello, I am considering using nhibernate in my project, but I have > > some questions about the way it works that I was hoping someone could > > answer. > > > First, when an update operation is performed, does it update all > > fields in the entity, or only the changed fields? I ask, because the > > database I have to use (and I don't control it's format, nor can I > > change it in any way) has a number of triggers that operate on the > > updated data (such as logging). So an UPDATE foo SET bar=1, zoo=2 > > would log both bar and zoo, even if the value of 2 hadn't actually > > changed. Linq2Sql only updates the fields that have chaned, and I was > > curious if nh did the same. > > > Second, and again this is an issue because of triggers in the > > database, I have a table that when a new record is inserted, the > > trigger automatically inserts records in other (child) tables and > > makes the table a foreign key. This ensures that all tables have > > default records if a parent record exists. Consider this as something > > akin to inheritence where there's a common set of data, and depending > > on a discriminator other tables are used in a given entity. For > > example, if you had a person table, and an employee table that used > > person as a foriegn key. > > > I understand how to make the employee table use the two tables via a > > discriminator. My concern that when a new employee is created, only a > > person is created, and a default employee record gets created > > automatically by the trigger if it's personType field is "employee". > > > How exactly would nh deal with this situation? I would be creating an > > entity which joins the parent and child tables into a single entity, > > but when I create a new entity it would need to only create the sql to > > create the parent (since the children get created automatically). > > does nh have support for this, or would I have to issue my create sql > > seperately?- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
