This question is locked. New answers and comments are not allowed.
Hello,
I am trying to use version for db-optimistic-locking. Let me clear my scenario:
I have business layer that act as the data transporter between my database and UI layer.
I have model classes which transform the data from database to contract classes (contract classes are consumed by UI- IN my case its Flex Builder). so from my scenario its clear that i am working on disconnected mode.
I have a contractClass and modelClass(Persistent class), Contract class have one more field names VersionInformation.
I bring data in model class from data base, got the version of the modelClass and attach the version to VersionInformation field of contractClass.
string versionInformation = Telerik.OpenAccess.DataObjectKey.Obtain(modelClass);
contractClass.VersionInformation = versionInformation;
Here I what I am getting in VersionInformation is not proper,
it is giving me :
+ { path of the modelClass}:{PrimaryKey of the model class}
for example
+{LanguageComponent.Model.MtLangauge}:{6101146} [here MtLanguage is the persistent modelClass and 6101146 is the value of primary key for retrieved record].
Now I bring the contractClass to UI, and I modified the same record at UI. But in between I change the column value for same record in database or someone else updated the same record.
Now after updating the contractClass properties values I bring the same contract to Business layer, at business layer I get the latest record from dataBase and again generate the VersionInformation, and compared the oldVersion with the latest version that is generated based on modelClass object that is just retrieved from database for the same primary key. As someone else already updated the same record , it must give a different version to me for the same record but it is giving the same versionInformation value. because in versionInformation i got class path and primary key combination.
I also try with ora_rowscn, It works fine, but for this I have overhead of adding additional attribute in my persistentclass(modelClass) and also mapping of this attribute from contract to model class. If I will successfully use versioninformation I would save my lot of time by not adding additional attribute in my all model classes, and doing mapping for same.
Please correct me where I m wrong in my approach regarding VersionInformation.
Regards,
Dev
I am trying to use version for db-optimistic-locking. Let me clear my scenario:
I have business layer that act as the data transporter between my database and UI layer.
I have model classes which transform the data from database to contract classes (contract classes are consumed by UI- IN my case its Flex Builder). so from my scenario its clear that i am working on disconnected mode.
I have a contractClass and modelClass(Persistent class), Contract class have one more field names VersionInformation.
I bring data in model class from data base, got the version of the modelClass and attach the version to VersionInformation field of contractClass.
string versionInformation = Telerik.OpenAccess.DataObjectKey.Obtain(modelClass);
contractClass.VersionInformation = versionInformation;
Here I what I am getting in VersionInformation is not proper,
it is giving me :
+ { path of the modelClass}:{PrimaryKey of the model class}
for example
+{LanguageComponent.Model.MtLangauge}:{6101146} [here MtLanguage is the persistent modelClass and 6101146 is the value of primary key for retrieved record].
Now I bring the contractClass to UI, and I modified the same record at UI. But in between I change the column value for same record in database or someone else updated the same record.
Now after updating the contractClass properties values I bring the same contract to Business layer, at business layer I get the latest record from dataBase and again generate the VersionInformation, and compared the oldVersion with the latest version that is generated based on modelClass object that is just retrieved from database for the same primary key. As someone else already updated the same record , it must give a different version to me for the same record but it is giving the same versionInformation value. because in versionInformation i got class path and primary key combination.
I also try with ora_rowscn, It works fine, but for this I have overhead of adding additional attribute in my persistentclass(modelClass) and also mapping of this attribute from contract to model class. If I will successfully use versioninformation I would save my lot of time by not adding additional attribute in my all model classes, and doing mapping for same.
Please correct me where I m wrong in my approach regarding VersionInformation.
Regards,
Dev