> According to you, when store()ing a record, which was previously 
> loaded from the database, whose primary key value was modified in 
> Java, then the record should be updated as such: 
> UPDATE [table] SET [pk] = [new value], ... WHERE [pk] = [original value] 
>
>
Yep, to put it in a nutshell :). Otherwise I would expect to do 
record.copy() if I wanted to create a new record.

Small example. If I did
Record r = factory.... fetch();
r.setFieldXValue(someNewValue);
r.store();

I would expect it to update, no matter what field was changed (so if it was 
the primary key or not it shouldn't matter)

If I did

Record r = factory.... fetch();
Record r2 = r.copy();
r2.setFieldXValue(someNewValue);
r2.store();

Then have a new record.


But as changing it was break existing code which "clones" a record without 
explicitly calling copy(), I would propose to have a setting which 
indicates what behaviour should happen on a primary key update when using 
.store()

Reply via email to