db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Torque, Transactions and Container (Bea)
Date Fri, 25 Nov 2005 09:04:31 GMT




Sorry, I have no idea how the container handles its transaction. Are you
sure it does not use the jdbc transaction mechanisms? Torque does not have
its own transaction mechanism, it uses jdbc transactions.
To be honest, I do not know how jdbc transactions can de 'disabled'. To
explain that: The transactional behaviour is different for different
databases. E.g. for oracle, the first select/update/insert... command
automatically starts a transaction, whatever you do. For older mysql, for
example, you do not have transactions at all, i.e. all you have is an
autocommit sort of behaviour.
In any case, the changes will have to be committed at the end, be it
automatically after each command, or be it manually by issuing a commit on
the connection, otherwise any changes you do will not hit the database.
But maybe the container does the final commit, although I have no idea how
the container should know when the transaction starts and when it ends. If
the container commits, I would guess your code is correct.

    Thomas

"Vitzethum, Daniel" <Daniel.Vitzethum@gigatronik.com> schrieb am 24.11.2005
13:00:20:

> Hello all,
>
> a question concerning Torque and Transaction handling. We are
> using Torque 3.1 with Bea 8.1. Tx should be handled by the
> Container. What is the best strategy to disable Torque's own
> transaction?
>
> I've been playing around with Transaction.beginOptional(),
> but don't like to do these calls in every finder or save method.
> Is there a property to set? Or a hook to get into?
>
> This is how I would solve it by now:
>
> -----
>   Connection conn = Transaction.beginOptional(Torque.getDefaultDB(),
> false);
>   conn.setAutoCommit(false);
>   MyPeer.doInsert/Update/Delete(Criteria, conn);
>   Torque.closeConnection(conn);
> ------
>
>
> Thx for your help,
>
> Daniel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
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