Hi,

This email is a continuation of discussion started at
http://www.jpox.org/servlet/forum/viewthread?thread=4893&lastpage=yes .

Quick summary is that there is a number of [I believe fairly strong] cases
where application deals with transient objects which somehow correspond to
already persisted objects.

These instances have updated state in there, but persisting that state takes
extra code and datastore hits, just to preload persistent counterpart and
copy properties.

My question is whether it is possible and makes sense for JDO to support
"attachment" of transient objects, so that
a) all the steps required for such "attachment" become duty of JDO
implementation, not client code and
b) reads before update are optimized (e.g. one read for collection) or
eliminated at all.

Code-wise I imagine methods like

// Application identity
<T> T attachTransient(T instanceWithAppIdentity);
<T> Collection<T> attachTransientAll(Collection<T>
instancesWithAppIdentity);

// Datastore identity - client code provides id explicitly to let JDO
identify persistent counterpart
<T> T attachTransient(T instanceWithDSIdentity, Object id);
<T> Map<Object, T> attachTransientAll(Map<Object, T>
instancesWithDSIdentity);     // Map is {id => instance}

What do you think?

Thanks,
Pavel

Reply via email to