Hi Bengt,
  I find that accessing the old state is possible using internal mechanics
-- but could not find a way to do it from the current API unless I expose
some internals. After a bit of deliberation, I am suggesting that we add the
following method to SaveFieldManager.

    /**
     * Gets the old values for the given list of fields provided they are
dirty.
     * @param fields a list of field names. null implies all dirty fields.
     * @return a map of old values for each given field, if they are dirty.
     * The map values are a pair of objects in an array -- the 0-th element 
     * is the old value and the 1-st element is the current value.
     */
    public Map<String, Object[]> getOldValues(String...fields)

I have tested your supplied classes with the classes you supplied.

If you do not mind being in the bleeding edge, i.e. if you can consume
OpenJPA nightly builds, then I will commit the changes.

 



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: 
http://openjpa.208410.n2.nabble.com/Audit-log-with-OpenJPA-tp6557932p6624609.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to