Tracking not persisting...

Sep 2, 2008 at 9:58 PM
Spring version (Catharsis-16702\CatharsisSolution_ver0.1)

Tracking gives the following error....

{"Hibernate operation: could not insert: [Framework.Entity.PersistentObjects.ChangeSet][SQL: INSERT INTO [dbo].[ChangeSet] (ValidFrom, ValidTo, NameProperty, ValueDateTime, ValueDecimal, ValueInteger, ValueString, ValueText, TObjectId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]; uncategorized DataException for SQL [INSERT INTO [dbo].[ChangeSet] (ValidFrom, ValidTo, NameProperty, ValueDateTime, ValueDecimal, ValueInteger, ValueString, ValueText, TObjectId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]; ErrorCode [<no error code>]; Cannot insert the value NULL into column 'TObjectId', table 'HighFive.dbo.ChangeSet'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated."} 

Please help....
Coordinator
Sep 13, 2008 at 4:16 PM
(First - sorry for so late answer!)
Tracking in Catharsis is strongly based on inheritance!!!

TrackedPersistentObject nested in Catharsis.Entity library provides all needed tracking. It is abstract class.
For 'simpler' usage in client code there is derived class Tracked in a 'Project.Entity',
which could (if you will need) gather some common behavior in your application (e.g. every Tracked object could have some Tag object property...)

Well, we have abstract class Tracked in our 'Project.Entity' library as a starting point.

Now let's say we have object Subject which should be tracked.
We wil inherit it from Tracked (you can use guidance)
and in NHibernate .hbm.xml file use definition with joined-class (inherited)

SQL syntax must follow that setting in this way:
Create table Subject with column SubjectId. It must be primary key, but without AUTO IDENTITY!
The ID will be generated in a mother class TObject, on the columnt TObjectId!
Value of that TObjectId will be then (automatically by NHibernate) put in tables
1) Tracked column TrackedId and 2) Subject column SubjectId -> all three tables together means object Subject

If Catharsis framework will insert new Subject in database, it will insert records in all needed tables, and generate unique ID only once.

I have to say - I AM VERY SORRY!
I did not mentioned your question! (I did not believe that any body will use Catharsis)
I will provide documentation, it will help a lot