Re: commitChanges() doesn't imply commit in db ?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 03 2007 - 12:23:41 EDT

  • Next message: Andrus Adamchik: "Re: postgres, idle in transaction"

    While I've never seen hung transactions in my apps, there were other
    users [1] who are seeing some strangeness. So let's try to figure out
    what's going on.

    1. What DataSource are you using - Cayenne-provided or some other
    (e.g. container-provided). Either should work of course, but this
    information should help in debugging.

    2. Are you using container-managed transactions? If you are, you have
    to check "container-managed transactions" [2], and ensure that
    whatever transaction mechanism is used (i.e. explicit J2EE
    UserTransactions), you commit them explicitly.

    These are the starting points to debug the transactions.

    Andrus

    [1] http://objectstyle.org/cayenne/lists/cayenne-user/2007/04/0019.html
    [2] http://cayenne.apache.org/doc/understanding-transactions.html

    On Apr 3, 2007, at 12:03 PM, jerome moliere wrote:

    > Thanks for your reply michael,
    > i was wondering about my code ....
    >
    > 2007/4/3, Michael Gentry <blacknex..mail.com>:
    >>
    >> Hmm, this is interesting. I've noticed transactions uncommitted
    >> against
    >> our
    >> Sybase DB, too. I've usually attributed this to a problem with
    >> the Sybase
    >> connection getting stale or something else going awry inside the
    >> database
    >> because our process (and the connection to the DB) is long-running
    >> (a web
    >> application that is hardly ever restarted) and the problem only
    >> occurs
    >> after
    >> it has been running for a while and a restart of the application
    >> clears
    >> the
    >> problem up (fetching data from the DB still works in our case,
    >> though). It
    >> sounds like yours isn't that long-term of a connection, though.
    >> Now I'm
    >> wondering if there is a problem with the Sybase driver or
    >> something inside
    >> Cayenne. Is there any chance you can make a repeatable test
    >> case? Our
    >> experience with the issue has been very intermittent and not
    >> reproducible
    >> and Cayenne was always logging the proper SQL.
    >
    >
    > in fact it's very simple, i'll try to make a small drawing of my test:
    >
    >
    > App1 = thread querying a table all 10 seconds
    > after the first query -> send a message on a tibco queue
    >
    > App 2 = wait for notification on the tibco queue
    > get the item (id passed into the message) then update this record (one
    > field)
    > send a message for notifying about field update via tibco
    > App 3 = wait for the notification and displays the new value (once
    > again
    > query on db)
    >
    > SO at this point app1 runs but with bad results after the first query
    > App2 seems to work but does'nt commit
    > App3 is never notified...
    >
    > I'll try to package a small test case using openjms ?
    > It's very disappointing because Sybase is the database choice from my
    > customers (like in many financial companies)...
    >
    > Cheers
    > jerome
    >
    > Thanks,
    >>
    >> /dev/mrg
    >>
    >>
    >> On 4/3/07, jerome moliere <jerome.molier..mail.com> wrote:
    >> >
    >> > Hi all,
    >> >
    >> > I'm doing a proof of concepts of several tricky usage from orm ,
    >> one of
    >> > the
    >> > 2 implementations is Cayenne...
    >> > I've one scenario where 3 process (stand-alone Java
    >> applications) use
    >> the
    >> > same table on db and communicate via Tibco rendez vous...
    >> > It works fine with Hibernate, but I 've got several problems with
    >> > cayenne...
    >> > latest one is while updating one object in one of these
    >> applications,
    >> > invoking commitChanges() on my context, nothing happens..
    >> > the query logger shows me a trans begin, the right update query
    >> but this
    >> > transaction is never committed
    >> > strange isn't it ?
    >> > This is the output (excerpt )from my process trying to update one
    >> entity:
    >> >
    >> > [java] INFO QueryLogger - +++ Connecting: SUCCESS.
    >> > [java] INFO QueryLogger - --- transaction started.
    >> > [java] INFO DbAdapterFactoryChain - DB name: Adaptive Server
    >> > Enterprise
    >> > [java] INFO QueryLogger - Detected and installed adapter:
    >> > org.apache.cayenne.dba.sybase.SybaseAdapter
    >> > [java] INFO QueryLogger - SELECT t0.AggregationCurrency,
    >> > t0.AllowFixing, t0.FixingAskSpread, t0.FixingBidSpread,
    >> t0.IsIslamic,
    >> > t0.IsLocal, t0.OISRoundingConv, t0.Currencies_Id FROM
    >> dbo.CurrenciesLocTt0
    >> > WHERE t0.Currencies_Id = ? [bind: 105] - prepared in 37 ms.
    >> > [java] INFO QueryLogger - === returned 1 row. - took 71 ms.
    >> > [java] INFO QueryLogger - +++ transaction committed.
    >> > [java] INFO CayenneCurrencyDAOImpl - before update
    >> isIslamicChar
    >> set
    >> > to = Y
    >> > [java] INFO CayenneCurrencyDAOImpl - after update this
    >> filed is
    >> now
    >> > set to = N
    >> > [java] INFO QueryLogger - --- will run 1 query.
    >> > [java] INFO QueryLogger - --- transaction started.
    >> > [java] INFO QueryLogger - UPDATE dbo.CurrenciesLocT SET
    >> IsIslamic
    >> =
    >> > ?
    >> > WHERE Currencies_Id = ?
    >> > [java] INFO QueryLogger - [bind: 'N', 105]
    >> >
    >> >
    >> > druid shows me that the tranaction is never committed, like one
    >> of the
    >> > other
    >> > applications lauching as a daemon a query on this table (does
    >> not show
    >> any
    >> > update because there are not..)
    >> >
    >> > Any clue ?
    >> > cheers
    >> > jerome
    >> >
    >> > --
    >> > Jerome Moliere - Mentor/J
    >> > http://romjethoughts.blogspot.com/
    >> > auteur Eyrolles
    >> >
    >>
    >
    >
    >
    > --
    > Jerome Moliere - Mentor/J
    > http://romjethoughts.blogspot.com/
    > auteur Eyrolles



    This archive was generated by hypermail 2.0.0 : Tue Apr 03 2007 - 12:24:21 EDT