Re: Optimistic locking seems not to work

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jul 28 2007 - 08:38:12 EDT

  • Next message: fishmac: "trouble w/ tutorial and foreign keys"

    >> > Now I start up my (Swing) application and create two instances
    >> of this
    >> > application.

    So just to confirm - those are two separate Java Virtual Machines,
    not two Swing windows running off the same VM?

    >> > Well, now I am quite astonished: When I load my object in
    >> instance one then
    >> > load my object in instance two and afterwards hit den button in
    >> instance 1
    >> > to modify & save the changes Cayenne sets an update:

    Is it possible that the action method that does an update and save on
    the 2nd instance also does a SELECT, resulting in refreshing the
    objects before commit?

    Andrus

    On Jul 28, 2007, at 3:27 PM, Jan Lendholt wrote:

    > Hi Michael,
    >
    > no, I did not enable the remote notifications. Neither ist
    > Container-Managed Transactions.
    > But Object-Validation und Use Shared Cache is enabled.
    >
    > Does this have any influence on my problem?
    >
    > Thanks, Jan
    >
    >
    >> From: "Michael Gentry" <blacknex..mail.com>
    >> Reply-To: use..ayenne.apache.org
    >> To: use..ayenne.apache.org
    >> Subject: Re: Optimistic locking seems not to work
    >> Date: Sat, 28 Jul 2007 07:44:52 -0400
    >>
    >> Hi Jan,
    >>
    >> When you configured your Data Domain in the Modeler, did you enable
    >> Remote Change Notifications under the Cache Configuration?
    >>
    >> Thanks,
    >>
    >> /dev/mrg
    >>
    >>
    >> On 7/28/07, Jan Lendholt <jlendhol..otmail.com> wrote:
    >> > Hey Folks,
    >> >
    >> > I'm using Cayenne now for 2 weeks and I'm still in my playground-
    >> phase to
    >> > check out the whole functionality of this leight-weighted, but
    >> yet easy to
    >> > use framework.
    >> >
    >> > Ok, here's my problem:
    >> >
    >> > I created a table storing a custimer id (KID), a name (name) and
    >> a status
    >> > (status).
    >> > This table has one recordset with kid=2133.
    >> >
    >> > Now I start up my (Swing) application and create two instances
    >> of this
    >> > application.
    >> > Ok, I have got two buttons - one button is getting the object
    >> "Kunde" (Kunde
    >> > = Customer, german) and the other button modifies via the setter
    >> setName and
    >> > send the modification with commitChanges().
    >> >
    >> > Well, now I am quite astonished: When I load my object in
    >> instance one then
    >> > load my object in instance two and afterwards hit den button in
    >> instance 1
    >> > to modify & save the changes Cayenne sets an update:
    >> >
    >> > INFO QueryLogger: UPDATE ACCESS.KUNDE SET NAME = ? WHERE KID
    >> = ? AND NAME =
    >> > ?
    >> > INFO QueryLogger: [bind: 'Test 1', 2133, 'Test']
    >> >
    >> > This is correct and works as expected.
    >> >
    >> > Now I hit the Modify & Save button in stance 2. i would expect
    >> that the
    >> > statement would look like:
    >> >
    >> > INFO QueryLogger: UPDATE ACCESS.KUNDE SET NAME = ? WHERE KID
    >> = ? AND NAME =
    >> > ?
    >> > INFO QueryLogger: [bind: 'Test 2', 2133, 'Test']
    >> >
    >> > And because no row is affected/the row has been modified in the
    >> meantime I
    >> > would cayenne expect to raise an exception.
    >> >
    >> > But instead I get the following queries:
    >> >
    >> > INFO QueryLogger: UPDATE ACCESS.KUNDE SET NAME = ? WHERE KID
    >> = ? AND NAME =
    >> > ?
    >> > INFO QueryLogger: [bind: 'Test 2', 2133, 'Test 1']
    >> >
    >> > Where did cayenne get the new value for name which has been set
    >> just a few
    >> > seconds before? Shouldn't cayene raise an excepption?
    >> >
    >> > In the modeler I checked the optimist locking checkbox and
    >> checked the
    >> > name-attribute to be used for optimistic locking and all
    >> references.
    >> >
    >> > Maybe one could help me, I really do not understand when cayenne
    >> is about to
    >> > raise an exception for optimist locked tables.
    >> >
    >> > Thanks in advance & best regards form Hamburg/Germany,
    >> >
    >> > Jan
    >> >
    >> > _________________________________________________________________
    >> > Die neue MSN Suche Toolbar mit Windows-Desktopsuche. Suchen Sie
    >> gleichzeitig
    >> > im Web, Ihren E-Mails und auf Ihrem PC! Jetzt neu! http://
    >> desktop.msn.de/
    >> > Jetzt gratis downloaden!
    >> >
    >> >
    >
    > _________________________________________________________________
    > Die neue MSN Suche Toolbar mit Windows-Desktopsuche. Suchen Sie
    > gleichzeitig im Web, Ihren E-Mails und auf Ihrem PC! Jetzt neu!
    > http://desktop.msn.de/ Jetzt gratis downloaden!
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Jul 28 2007 - 08:38:47 EDT