cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Wiesmann <awiesm...@somap.org>
Subject State of DataObjects (uncommitted but nonexistent on DB)
Date Fri, 29 Feb 2008 09:07:02 GMT
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

Mime
View raw message