State of DataObjects (uncommitted but nonexistent on DB)

From: Adrian Wiesmann (awiesman..omap.org)
Date: Fri Feb 29 2008 - 04:07:02 EST

  • Next message: Tore Halset: "Re: Storing GMT dates?"

    Hello list

    I have some kind of exotic question concerning state of DataObjects. In a
    scenario I would like to create new DataObjects but keep them in a state
    so that they only get committed if the user actively changes some default
    value.

    Look at it like some lazy persist functionality. Let's say I have a
    reporting application (which I have not :) ) where I display a matrix to
    the user. X-axis are the days, y-axis are the projects. In every field in
    the matrix the user could write the hours he worked on the said project on
    the specific day. Which means I need to create DataObjects for all fields
    in the matrix so that the databinding works and the user can enter values
    into all of the fields. But I only want to persist those records which
    actually contain a value.

    I thought I could do so creating new DataObjects, setting default values
    and then immediately changing the state of the new DataObjects to
    committed. While this generally works (DataObject changes to modified
    once the user enters a value), the persist process of Cayenne is not
    amused since it thinks it should update a record in the database which
    does not already exist.

    So my question. Would there be another possible solution to my problem?

    Cheers,
    Adrian



    This archive was generated by hypermail 2.0.0 : Fri Feb 29 2008 - 04:07:44 EST