db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian Fray" <florianf...@compuserve.de>
Subject Re: Torque BaseXXX in Transaction and the isNew() Method Check
Date Sun, 26 Sep 2004 08:36:08 GMT
Hmm, the attachment isn't there, so if you're interested i could send it
to you directly via, just send me a mail.

Florian Fray

----- Original Message ----- 
From: "Florian Fray" <florianfray@compuserve.de>
To: "Apache Torque Users List" <torque-user@db.apache.org>
Sent: Saturday, September 25, 2004 11:06 AM
Subject: Re: Torque BaseXXX in Transaction and the isNew() Method Check


> I have had this problem some time ago, too.
> In my opinion, there is no simple solution. So I wrote some code
> to save those new-flags and manually rolled them back on an error.
> A solutian I've worked on is to change the Transaction-class by adding
> non-static methods for commit and rollback and two methods adding
> Jobs for post-commit and post-rollback processing. Finally there should
> be a save-method in the transaction, wich delegates to a save-method of
> a Base-Object and which adds a new-Flag-false-Job to the commit-job-chain.
> If commit is called, it should commit all changes and, if no exception is
> thrown,
> the commit-job-chain should be processed.
> I've made an implementation after reading your mail, cause my companies
code
> should not be contributed, as it contains too many specific changes. I'll
> append the code
> but it's not tested out now. It makes use of the fact that we are using
> BaseObjects which contain the save-Method (I think this is optional).
> Another way (my code doesn't exclude) is to add a save-Method which
> uses a Transaction-instance (this would be nice as the java.sql.Connection
> doesn't
> have to be used and won't appear in the app-code anymore).
>
> In the code you sent in, there is another error.
> The line "isAlreadyInSave = false" will never be executed if some
> exception is thrown. This could be easily fixed with a try ... finally
block
> in
> the template.
>
> Florian Fray


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message