RE: Kind of a simple question

From: Gentry, Michael (michael_gentr..anniemae.com)
Date: Wed Sep 22 2004 - 11:26:32 EDT

  • Next message: John Martyniak: "Re: Kind of a simple question"

    If you look in the DataNode of your model, you'll see a "Min
    Connections" field and a "Max Connections" field. If both are 1,
    Cayenne will only use 1. Adjust as you need.

    Cayenne can do optimistic locking (at least with 1.1, I don't remember
    about 1.0). In the DataMap section of your model, look at the ObjEntity
    configuration. Make sure you check "Optimistic Locking" under the
    "Entity" tab. Then under the "Attributes" tab there is a "Used for
    Locking" column with checkboxes for each attribute. You should check
    all of these fields in general, with the possible exception of BLOBs
    (you'll obviously need to decide what's important for your case). You
    can also select relationships to be optimistically locked, too.

    When you modify an existing record and save it back to the database,
    Cayenne will generate SQL something like this:

    UPDATE FooBar
    SET x = '123'
    WHERE x = 'foo' AND y = 'bar' AND z = 'baz' AND primaryKey = 547124

    In this example, your FooBar entity contained an "x", "y", and "z"
    column and you had them all checked under the "Use for Locking" column.
    Cayenne remembers the previous values of all the columns that are used
    for locking and includes those original values as part of the UPDATE
    statement. Of course, if one of the values got changed (like, you did a
    manual database fix), then the UPDATE will fail and your application can
    catch the error.

    /dev/mrg

    -----Original Message-----
    From: John Martyniak [mailto:jmarty..x.netcom.com]
    Sent: Wednesday, September 22, 2004 10:47 AM
    To: Cayenne User
    Subject: Kind of a simple question

    Hi,

    How many connections to the DB does Cayenne use, when used with
    Servlets?
    Does it maintain a single connection, or does it maintain a pool of
    connections?

    Also does Cayenne have any sort of Object Locking mechanism? Or does
    that
    need to be custom developed? Because I will have customers creating and
    updating records.

    The reason that I ask is that I currently use another ORM, that uses one
    (I
    think that it is two actually) connection to the DB when used in a
    Servlet
    container.

    I am getting ready to start a new project and would like to try it with
    Cayenne, but I have some concerns.

    Thanks in advance for the information.

    -John



    This archive was generated by hypermail 2.0.0 : Wed Sep 22 2004 - 11:26:37 EDT