Magnus,

In Torque, objects in your object model have a no-argument .save() method
that grabs a connection, starts a transaction, inserts/updates to whatever
tables are necessary, and commits the transaction.

All objects also define a save method that takes a connection:
save(DBConnection conn).  the no-argument save() method calls
save(DBConnection).  So the two code fragments are roughly equivalent:

1. obj.save()  // just save

2. DBConnection conn = BasePeer.beginTransaction(dbName);
obj.save(conn);
BasePeer.commitTransaction(conn);

"dbName" is the name of your database as defined in your schema and
Torque.properties.  You can also obtain the dbName at runtime from any peer
class in your object model (FooPeer.getDatabaseName(), perhaps?  It's in
there somewhere.)

-- Bill

> Hi,
>
> I just found out about this project and it looks interesting, mostly
because
> we have developed a similar thing to use in our projects. In our framework
> we expose the connection in the save() (which then is save(Connection))
for
> example to that we can handle JDBC transactions. How is that handled in
> torque? Can you for example insert one item into a table and update
another
> within the same transaction?
>
> /Magnus




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to