You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Andy Jefferson <an...@jpox.org> on 2007/11/10 09:27:28 UTC

Enhancement of persistent properties

In the current spec section 23 (JDO reference enhancer), the mention of 
jdoGetXXX, jdoSetXXX are in relation to persistent fields, and those methods 
are static since its trivial to have a static method that sets a field of an 
instance to a value. In terms of enhancement if the user had
int getId()
{
    return id;
}
this is converted to (in general terms)
int getId()
{
    ... checks on StateManager as appropriate for the field
    return jdoGetXXX();
}
static int jdoGetXXX(Object inst)
{
    return inst.id;
}

In the case of persistent properties it is no longer trivial since the 
getXXX() for example could have significant code. If the user has
int getId()
{
    ... complicated logic for generating a value using the various fields
    return val;
}
then JPOX generates
int getId()
{
    ... checks on StateManager as appropriate for the field
    return jdoGetXXX();
}
int jdoGetXXX()
{
    ... complicated logic for generating a value using the various fields
    return val;
}

Consequently the jdoGetXXX, jdoSetXXX are no longer static. This has no 
detrimental effect on anything, just that we could have a mention in the spec 
section 23.20 to this effect.

-- 
Andy  (Java Persistent Objects - http://www.jpox.org)