On 12/27/05, Dennis Bekkering <[EMAIL PROTECTED]> wrote:

> I don't understand the following, how those the kit know if the connection
> already is in a transaction?
>
> public Iterator moreRealisticQueryByCriteria(Query query, int lock)
> {
>      OTMKit kit = SimpleKit.getInstance();
>      OTMConnection conn = null;
>      Transaction tx = null;
>      try
>      {
>          conn = 
> kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());
>          tx = kit.getTransaction(conn);
>          boolean auto = ! tx.isInProgress();
>          if (auto) tx.begin();
>          Iterator results = conn.getIteratorByQuery(query, lock);
>          if (auto) tx.commit();
>          return results;
>      }
>      finally
>      {
>          conn.close();
>      }
> }

I'm not too familiar with OTM, but this should depend on how/where the
transaction is handled, e.g. how your database access and how OJB are
configured.

Tom

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

Reply via email to