You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by keithBacon <ke...@yahoo.com> on 2002/02/21 17:43:09 UTC

Code To Update DB With Transactions (was RE: EJB = bad = MS.net)

Ah ha - I thought you'd imply that you only do it this way
if you are doing updates! Catch me out some other way!
There's got to be some other catch.......
Keith.
PS. No being frivolous on the list tomorrow
 - I'm not around to appreciate it!
 
--- "Galbreath, Mark" <Ga...@tessco.com> wrote:
> Yes.  If the query is a simple read, you don't need the transactions checks.
> 
> :-)
> 
> Mark
> 
> -----Original Message-----
> From: keithBacon [mailto:keithbaconstruts@yahoo.com]
> Sent: Thursday, February 21, 2002 9:54 AM
> 
> Is there anything wrong with the design below?
> Is there anything simpler? (Are EJB's simpler?).
> I typed this from memory from my last job. it was never really
> seriously tested but worked in practice with low volumes.
> 
> try {
>        // gets connection - ensures AutoCommit off & starts transaction.
>    Connection cnct DbUtils.getConnectionWithTransaction(..)
>    DBUserValidator.saveToDb(cnct);
>    DBAuthorisationValidator.saveToDb(cnct);
>    DbUtils.commit(cnct);
> } catch (Exception e) {
>    DbUtils.backout(cnct);
>    throw e;
> } finally {
>    DbUtils.releaseConnection(cnct);
> }      
> =======================
> cheers - Keith.
> 
> --- "Cakalic, James" <Ja...@heybridge.com> wrote:
> > Even if all the data is in a single physical RDBMS instance, your design
> has
> > to take one of several paths to deal with transactional issues.


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>