On 31/07/2007, at 11:26 PM, Jan Lendholt wrote:
> I created an object via context.newObject(Service.class);
>
> Before I do a context.commitChanges() I check if there are any
> input errors in the input fields that should be set to the object.
> If we encounter an exception, we abort the creation / editing of
> the current object.
>
> Now, in the meantime, I take another window to create another
> object, like context.newObject(Person.class) and call the
> context.commitChanges().
>
> Now, the old object, at which the check of the data failed, ist
> committed as well.
Just to add to Michael's useful comments, what we do is have one
'shared' context which is used to display lots of read only data.
These usually represent records in some sort of list (which you
double click to edit). This is shared between all open windows and
other processes and is only read from. Then each editable window
creates its own editing context as needed. This gives a good balance
between caching of data (in the big shared context) and small
flexible contexts for editing.
In the notes above it appears you might be missing the concept of
validation in Cayenne. You don't need to validate data before you
populate the object. Better to put the data directly into your object
entity and then try to commit it. Any validation exceptions can then
be properly dealt with by your code and GUI.
Ari Maniatis
-------------------------->
Aristedes Maniatis
phone +61 2 9660 9700
PGP fingerprint 08 57 20 4B 80 69 59 E2 A9 BF 2D 48 C2 20 0C C8
This archive was generated by hypermail 2.0.0 : Tue Jul 31 2007 - 10:06:50 EDT