In Transaction with Save Many Objects When I Save Each Object( I think your program keep object in cache for each save )
IF Transaction is rollback database is rollback correct but cache is not rollback.
What should I do?
I need you to guide me to solve this problem.
I have no idea to solve it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mproduct is inheriting from CPersistentObject.
and my code as :
Try
persistenceBroker.startTransaction()
m_product.Save()
'persistenceBroker.commit()
persistenceBroker.rollback() ' For test rollback
Catch ex As Exception
persistenceBroker.rollback()
Throw ex
End Try
Anya
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Collections are a pain. I've duplicated the problem here.
The issue comes because the collection itself is not actually stored in the cache. The object that references the collection (objA) is in the cache, and the objects that are part of the collection (objB, objC, etc) are also cached, but the collection object itself (ie the CPersistentCollection) is not.
What then happens is that the ObjA, ObjB, etc objects are correctly restored to their previous state when the transaction aborts, but that the referenced collection object is not restored.
I need to figure out a clean solution to this, so give me a little time. (I've created a bug entry so that I don't forget).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, CVS is now updated with the latest code to correctly restore collections.
I have only tested it with the CPersistentCollection at this stage, however the code works the same regardless of collection type so it should be fine for array lists, hashtables, etc.
Collections that implement ICloneable are copied using the clone method, other collections are copied using a for-each loop.
Please try it out and let me know if you find any issues or problems.
- Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Transaction with Save Many Objects When I Save Each Object( I think your program keep object in cache for each save )
IF Transaction is rollback database is rollback correct but cache is not rollback.
What should I do?
I need you to guide me to solve this problem.
I have no idea to solve it.
Hi,
I've just read your post and it occurrs to me that I've never actually checked for this, and that it's a definite problem :-(
The framework should handle it for you, so let me have a look at my code and fix it. I'll post a message when the changes are done.
- Richard.
Hi,
This problem is fixed now and CVS has been updated. Please get the latest code from there.
Hi Richard
This problem, I get it now. I use AtomsFramework 2.0
"IF Transaction is rollback database is rollback correct but cache is not rollback. "
Help me please
Anya
Hi.
I have a same problem. I am using Atomsframework 2.0 and the last CVS.
To solve this problem i am deleting a cache, but it isn't the major solution
I'll need to check this. The cache should be restored to it's pre transaction state if a transaction is aborted so I assume something must be broken.
Can you tell me what method for persistence you are using? (ie inheriting from CPersistentObject, or not)
Even better would be some code that duplicates the problem :-)
Hi,Richard
mproduct is inheriting from CPersistentObject.
and my code as :
Try
persistenceBroker.startTransaction()
m_product.Save()
'persistenceBroker.commit()
persistenceBroker.rollback() ' For test rollback
Catch ex As Exception
persistenceBroker.rollback()
Throw ex
End Try
Anya
if u cann't solve this problem at this time,
how can i clear cache or not use cache or Other suggests?
Anya Is My Colleague
Monsak.
Ooops. Sorry. I've been on annual leave and I forgot about this problem.
It's fixed and tested now and I've updated CVS. You will need to get the latest version of the source code from there.
Let me know if there are any other problems.
- Richard.
I and Anya have download from cvs at http://cvs.sourceforge.net/viewcvs.py/jcframework/dotnet/?sortby=date#dirlist
Files
1) CPersistenceBroker.vb (R 1.88) 4 weeks
2) CPersistentCollection.vb (R 1.15) 5 weeks
3) CPersistentObject.vb (R 1.52) 6 weeks
to update my machine atomsframworks v2.0
but it's not work for this case
Help Me,Please
Monsak
Please apologize Me, in my office i cann't log this site. I don't know why.
The public CVS takes time to update from the developer version (and lately it's been quite slow).
You will need the latest CConnection.vb code (when it becomes available).
Hi.
I have a last CVS. But it isn't correct.
I am removed any objects of the collection and when i am executed rollback, only database is executed and not cache.
Why if I remove a object of the collection and executed rollback, this collection don't have a object????????????
Collections are a pain. I've duplicated the problem here.
The issue comes because the collection itself is not actually stored in the cache. The object that references the collection (objA) is in the cache, and the objects that are part of the collection (objB, objC, etc) are also cached, but the collection object itself (ie the CPersistentCollection) is not.
What then happens is that the ObjA, ObjB, etc objects are correctly restored to their previous state when the transaction aborts, but that the referenced collection object is not restored.
I need to figure out a clean solution to this, so give me a little time. (I've created a bug entry so that I don't forget).
OK, CVS is now updated with the latest code to correctly restore collections.
I have only tested it with the CPersistentCollection at this stage, however the code works the same regardless of collection type so it should be fine for array lists, hashtables, etc.
Collections that implement ICloneable are copied using the clone method, other collections are copied using a for-each loop.
Please try it out and let me know if you find any issues or problems.
- Richard.
Hello Richard Banks
i get source code from CVS and Test about My case I work. but CVS server update too slow i wait for source code from CVS about 9 hours.
Thanks a lot.
Monsak
To solve this problem, i am clear cache, but the solution of cache rollback of the collection is better.
Saludos
Victor