On Mar 27, 2007, at 12:43 AM, Lachlan Deck wrote:


Would localObject(Persistent) then be better as an interface than localObject(ObjectId,Object)? The latter is already possible via DataObjectUtils.objectForPK(ObjectContext,ObjectId). But the former seems more generally useful.

Well - 'objectForPK' is a different operation from localObject(..) due to the prototype argument to the later.

As a side note, I'd love to rework 'localObject' all together to make it less confusing. Maybe something along the lines of JPA "merge" and "persist" methods? Anyways this requires more thought.


+    public Persistent localObject(ObjectId id, Object prototype) {
+
+        if (id == null) {
+            throw new IllegalArgumentException("Null ObjectId");
+        }
+

+1, but note that there are some slight differences between DataContext and CayenneContext implementation. Don't recall all the details, but it would be nice to diff them and see what we can do about them.

There was no difference actually. The only diff was a comment in CayenneContext saying that this was a direct copy from DataContext and a comment in DataContext instructing people to remember to copy the implementation to CayenneContext and a TODO saying we need to find inheritance somehow... so it seemed the natural thing to do the todo.


Just curious - have you tried the actual diff of those two implementations? That comment may be there, but I have a vague recollection that one of the implementations nevertheless has been altered.

Andrus



Reply via email to