You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Steven Richman <ju...@shift9.com> on 2003/04/10 18:46:45 UTC
PB txns in OJB Query / ODMG mix?
Hi,
I'm a new OJB user. I just implemented support for using OJB Queries with
ODMG, as discussed in the FAQ "I don't like OQL, can I use the
PersistenceBroker Queries within ODMG?"
The FAQ says to consult org.apache.ojb.odmg.oql.OQLQueryImpl.execute() to
see how to do it. It also offers a code example that contains
Transaction tx = OJBFactory.getInstance().currentTransaction();
PersistenceBroker broker = ((HasBroker) tx).getBroker();
broker.beginTransaction();
ManageableCollection result =
(ManageableCollection) broker.getCollectionByQuery(
this.getCollectionClass(),
query);
broker.commitTransaction();
...
However, the code in OQLQueryImpl.execute() never calls
PersistenceBroker.beginTransaction()/commitTransaction(). Are these calls
necessary, or can I safely omit them? I don't really understand what's
going on with the two kinds of transactions (PB and ODMG) in the above
code, so if someone can clarify I'd appreciate it.
Thanks,
steven.