Hi Ryan,

2013/7/31 Ryan How <[email protected]>

> Hi Lukas,
>
> Just a follow on from this discussion.
>
> https://groups.google.com/d/msg/jooq-user/0F1YSZB2xDk/BDrz9cBxnngJ
>
> Is there a way to set the records "original" values after a store()?. We
> can set the changed flag, and reset the value to match the original value,
> but I couldn't see a way to set the original value itself? I might just be
> missing some obvious.
>

There's currently no obvious way to do that. If you look at jOOQ's
internals, you can modify "original" values as such:

    record.setValue(field, originalValue);
    record.changed(field, false); // Sets originalValue onto "original"

Or, if you want to retain distinct "original" and "value" values:

    T value = record.getValue(field);
    record.setValue(field, originalValue);
    record.changed(field, false);
    record.setValue(field, value);

This has a tweaky touch to it, though, use at your own risk :-)

The reason being that the original values are used for the optimistic
> locking check. After a store, then subsequent fail and transaction
> rollback, I need to manually roll back the original values, or the
> optimistic lock check will fail next attempt. I hope that makes sense.
>

I remember the discussion. Can you shed some light on the projected
algorithm? Are you using ExecuteListeners to inject some transaction
management into jOOQ? Maybe, after all, a "magic", long-term solution will
yet unveil...

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to