Bad bad bad design..
Never do history in the same table! Either use seperate tables or even better a seperate database. The logic that you want regarding history and versioning really is not up to NHibernate to implement. What you could do is intercept changes through eventing and then store the previous data in a seperate table (or a seperate dabase). On Mar 18, 7:02 am, "[email protected]" <[email protected]> wrote: > I'm really curious how the mapping of an entity in NHibernate would > look when the entity inherits from an interface named IVersioned. > Basically, the purpose of this interface is to uniformly identify an > object that has a Version and RecordCreated timestamp. As far as the > database schema goes, I'm envisioning two tables per versioned > object. As an example, let's take an Employee object. I'm > envisioning one table called tbEmployee that has a surrogate primary > key and a RecordCreated timestamp column. I'm also envisioning > another table called tbEmployeeInfo which is a versioned table that > retains all historical changes to Employee objects. The primary key > of this table would be a composite key comprised of the numeric > version and an integer column containing the primary key in > tbEmployee. Thus, tbEmployeeInfo could potentially have a first and > last name column, as well as contact information. If the employee > updates their information, I want to instruct NHibernate to always > insert a new row with an incremented version number and never call > update. I tried playing with the new event listener model in NH 2.0, > but didn't get past the xml mappings dilemma. Also, I've seen some > auditing solutions but they all show how to insert rows of various > entity types into one table. I would like one audit table per > entity. Any feedback is VERY MUCH APPRECIATED. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
