Further Weirdness with DB2 Transactional Save


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Good deal Smile
PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Trent L. Taylor (11/07/2007)
When it is created, it is just going to fire the normal component events. The only custom event that gets fired at creation time is the ParentFormLoading which will not fire if it is created in code. The events related to the BO are going to be once the object is created. I am not very clear on your question so I don't know if that is what you were looking for or not. Ermm




That answers my question. I was after whether ParentFormLoading fired when it was created in the background. I just had a cryptic way of getting there. BigGrin



Thanks!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
When it is created, it is just going to fire the normal component events.  The only custom event that gets fired at creation time is the ParentFormLoading which will not fire if it is created in code.  The events related to the BO are going to be once the object is created.  I am not very clear on your question so I don't know if that is what you were looking for or not. Ermm
PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I should probably qualify that question. What events are fired off on the business object when it's created in the background? Smile I realized there were a couple different ways to answer that right after I clicked "Post". :-).
PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Ben Chase (11/07/2007)
Yep, that about sums it up Smile



Glad you got it working.




Me, too. Smile



New question, now (though related in a very roundabout way). Smile What events are fired off when you create a business object on the fly (i.e. in the background when its going to be filled and used to populate a DropDownList)?
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, that about sums it up Smile

Glad you got it working.

PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Ben Chase (11/06/2007)
Aha, that's the problem... the transaction is owned by the data source... it's not static. So, the transaction has to be started on the data source that is being used by the business object, not just on any data source. There are wrapper methods on the BusinessLayer class that can start the transactions, so you might try to use one of those:



BusinessLayer.TransactionBegin(this.someBo.DataSourceKey, "TranKey");




I changed the code to look like this:





// Start the transaction

if (!DataLayer.DataSources[Authorization.DataSourceKey].Transactions.ContainsKey("PermissionsUpdate"))

{

SqlHandler.Tracer.LogMessage("Starting transaction: PermissionsUpdate", TraceLevel.Verbose);

BusinessLayer.TransactionBegin(Authorization.DataSourceKey, IsolationLevel.ReadUncommitted);

}





It corrected the problem. I believe I understand why, now. Essentially, because I had put the connection into it's own container (the mySqlh property), the transaction starts/stops I called there really didn't have an effect on the DataLayer the business objects used. Does that about sum it up?



Thanks!

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Aha, that's the problem... the transaction is owned by the data source... it's not static.  So, the transaction has to be started on the data source that is being used by the business object, not just on any data source.  There are wrapper methods on the BusinessLayer class that can start the transactions, so you might try to use one of those:

BusinessLayer.TransactionBegin(this.someBo.DataSourceKey, "TranKey");

PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Ben Chase (11/05/2007)
You say that you initialize the DataSourceKey on the business objects from the value in the config file... How are you initializing it? Are you just setting the value in the constructor, or some other way?




I have a method in the Global.asax file that I call during the Page_Init event. It takes a parameter of type ApplicationBasePage (pass in "this" as the parameter value) and set the data source keys on all the objects that way.



Ben Chase (11/05/2007)
Most likely, it seems that the transaction is being started on the wrong data source (say the tran is getting started for data source "", while the business object is expecting it to be started for data source "MyDataSource"). Check the place where you call TransactionBegin() and make sure that you're using the data source key from your config file to start the transaction.




That was what I started to think might be the problem, but I've only got one data source object that I'm using. Also during Page_Init I assign a value of type Db2DataSourceItem to a page-level object attribute (mySqlh). I call the TransactionBegin off this object. It's worked fine on all my other pages (starting the transaction on the same page-level object attribute), it's only on this one page that I seem to be having a problem. It's very strange.



Here's the code where I start it:





// Start the transaction

if (!mySqlh.Transactions.ContainsKey("PermissionsUpdate"))

{

SqlHandler.Tracer.LogMessage("Starting transaction: PermissionsUpdate", TraceLevel.Verbose);

mySqlh.TransactionBegin("PermissionsUpdate", IsolationLevel.ReadUncommitted);

}





I don't think there's much I can really screw up on it and I've used this same method all through my application. As I said, it's just on this one page.



Thanks!

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You say that you initialize the DataSourceKey on the business objects from the value in the config file... How are you initializing it?  Are you just setting the value in the constructor, or some other way?  Most likely, it seems that the transaction is being started on the wrong data source (say the tran is getting started for data source "", while the business object is expecting it to be started for data source "MyDataSource").  Check the place where you call TransactionBegin() and make sure that you're using the data source key from your config file to start the transaction.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search