Questions about Ordering, Optimistic Locking and QueryTable

From: Adrian Wiesmann (awiesman..omap.org)
Date: Sun May 18 2008 - 10:09:54 EDT

  • Next message: Aristedes Maniatis: "Re: Questions about Ordering, Optimistic Locking and QueryTable"

    Hello list

    Instead of writing three separate mails I thought it would make sense to
    pack these three questions together:

    Ordering
    --------
    I am having a list of DataObjects where one field represents a human
    readable Id. Something like this:

    "1.1.1" (as example)

    When using the (offline) ordering mechanism of Cayenne to order a list of
    DataObjects, things get ugly when I am introducing numbers above 10. Like
    the following example:

    1.1.1
    1.1.2
    1.10.1
    1.10.2
    1.2.1
    1.2.2

    I would like to have the 1.10.x numbers below the 1.2.x numbers. Which
    means I would like to sort mathematically and not alphabetically.

    Is there any possibility to tell Cayenne to sort differently? Or would I
    need to add a new (virtual) field to the DataObject with a clean sort
    number and have Cayenne sort that field instead?

    Optimistic Locking
    ------------------
    My DataObjects contain a datetime field and a string field which both are
    used for optimistic locking. Basically the fields contain the datetime of
    the last change plus the user Id of the user persisting the change.

    When using optimistic locking with Derby everything works as expected.
    When using the same code and configuration with PostgreSQL (7 and 8) I
    receive an optimistic locking failure although nothing has changed on the
    database in the meantime.

    When I then remove the datetime field only from the optimistic locking
    check things work as expected.

    Has anybody experienced the same? Is this a known problem or am I missing
    something?

    QueryTable
    ----------
    We were discussing that on this list before. I am looking for a way to
    generate DataObjects without a reference to a table in the database.
    Something like a virtual DataObject.

    My usage scenario is it to have a DataObject which can be bound to the UI
    but which is only used to prepare data for a query and never should be
    persisted to the database.

    I remember some discussion about introducing some kind of inheritance to
    Cayenne which would support my usage scenario. I just wanted to check back
    with you if something already happened there?

    Thanks for your help.

    Cheers,
    Adrian

    P.S: Andrus: I remember you talking about being interested in learning
    about experiences with Apache Wicket? The Wicket Framework is great and
    using it with Cayenne works like a charm. Wicket is really a webframework
    done right!



    This archive was generated by hypermail 2.0.0 : Sun May 18 2008 - 10:10:31 EDT