I am trying to evaluate the spring version (Catharsis-16702\CatharsisSolution_ver0.1) .
The code updates an object but the object tracking is not working,
TrackedPersistentObject.Changes has all the changes recorded.
In the method NHTrackedDAO.Update(entity), the transaction passes the line "HibernateTemplate.Update(entity) " without any errors.
I think the hbm files for tracking are not getting loaded, because if I remove the hbm files for tracking in HR.Entity then also the code doesn't complain. No nHibernate query is generated, it seems.
In my my nHibernate settings I have referred the appropriate assemblies and created the database also.
Please advice if I am missing on something or how could I debug more.
Actually I was missing on applying inheritence in my object mapping files.
This works now.
Sep 13, 2008 at 4:38 PM
(Sorry for so late answer)
To allow tracking you have to derive from Tracked object (As you correctly mentioned)
But the key to tracking is the PAX design pattern (which is my own and therefore needs to be explained :)
If you create new object using Guidance (Right click on 'YourProject.Entity' project and you will see the menu item to (Re)Create Entity)
you will get everything what you need to start.
If you (in Guidance wizard) check the "Tracked" option, than you will be provided with needed actions for PAX pattern on UI.
How PAX design pattern works? There are three life-time conditions:
1) Prenatal - object at this state is not tracked. Users can changed it even delete it, and there will be no tracked changes.
This condition should be used in cases that user is 'playing! with setting object (Preparing questionnaire, and still not satisfied...)
Prenatal condition could be changed to next condition only by calling Objects method 'MakeAlive()' (for example using button MakeAlive on UI)
2) Alive - After making Alive of a prenatal object, every change is tracked. (even the change from Prenatal to Alive condition)
Object stored in Database is lightweight! Only current values of all properties (ValueType properties) are stored in tables! Accessing object is clear and the 'Change set' is not dirtying the database.
There is special ChangeSet object (and Table) where are all changes stored - with the information about validity (from - to)
Any object can be in Alive condition for unlimited time (as well as in Prenatal). Then you can be sure, that any change is tracked.
If the object in Alive condition is deleted, its condition is changed to Expired and its ValidTo is set to todays 0:00.
The only possible change for object in Alive condition is MakeExpired
3) eXpired (to have PAX abbr :) is the last condition -> object is keeping is last values, all changes form his Alive period are available and can be displayed
But no changes can be made to eXpired object. NO CHANGES, Not even any! :)
Catharsis has built-in support for PAX behavior. You can even change the date and time on UI and all (Tracked not Prenatal) objects then will be restored to demanded time...
More will be in the documentation ... which will follow