I have a data import routine that needs to do approximately 500 or so inserts/updates across 6 tables in a SQL Server database within a single transaction (all succeed or all fail).
What is the best way to handle this in iBatis?
This is an ASP.net 1.1 application and I have a 1:1 mapping between iBatis DAL objects and tables in the database.
Related to the above, are there any good examples out there on how to properly do transactions with iBatis?
Roughly what I have for code (not currently using a transaction) is something like this (psudocode):
Visit TargetVisit = Visit.Find(1234);
TargetVisit.Status = VisitStatuses.Completed;
TargetVisit.Save();
foreach (collection of students){
Student AStudent = Student.Find(someid);
AStudent.Active = true;
AStudent.Save();
foreach (collection of data) {
TopicSection ts = new TopicSection();
ts.Property1 = "some value";
ts.Property2 = "some value";
ts.Save();
... This continues down 3 more tables...
}
}
Thanks for any suggestions on the best way to put this into a single transaction.
-Shawn
What is the best way to handle this in iBatis?
This is an ASP.net 1.1 application and I have a 1:1 mapping between iBatis DAL objects and tables in the database.
Related to the above, are there any good examples out there on how to properly do transactions with iBatis?
Roughly what I have for code (not currently using a transaction) is something like this (psudocode):
Visit TargetVisit = Visit.Find(1234);
TargetVisit.Status = VisitStatuses.Completed;
TargetVisit.Save();
foreach (collection of students){
Student AStudent = Student.Find(someid);
AStudent.Active = true;
AStudent.Save();
foreach (collection of data) {
TopicSection ts = new TopicSection();
ts.Property1 = "some value";
ts.Property2 = "some value";
ts.Save();
... This continues down 3 more tables...
}
}
Thanks for any suggestions on the best way to put this into a single transaction.
-Shawn
Yahoo! Photos Showcase holiday pictures in hardcover
Photo Books. You design it and well bind it!

