You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2009/11/19 17:55:10 UTC

Persistent objects design [Re: Plans for the future (aka 3.1 roadmap)]

I agree with most of the POJO comments in the thread. Since  
persistence engine has to do a bunch of tricks throughout the object  
lifecycle, it means that POJO is not really a POJO in any ORM. So this  
limits the abstraction anyways. At the same time not being able to use  
my persistent objects disconnected from context (e.g. to set  
relationships), or transfer a subgraph to a Cayenne-unaware client is  
annoying as well.

Considering my lack of time and lack of community interest in POJO, I  
don't expect an immediate implementation. What I wanted to make sure  
though is that we leave the door open for a POJO support with whatever  
design we go in 3.1. Aside from a few rough spots, Cayenne is ready to  
host POJO class descriptors, and maybe someday they'll materialize  
(BTW, we should've dropped experimental version of those from B1. They  
are not fully operational, but I guess no harm in them sitting in the  
jar).

Also my current concept of Cayenne POJO should not require agent-based  
existing class enhancement (using Java agents is more pain than any  
user can bare). It will be more like Tapestry, i.e. based on  
subclassing rather than redefining a class (not sure if Hibernate does  
the same thing? Or some kind of a proxy?):

public class MyObject {
    private int persistentField;
    ...
}

MyObject object = new MyObject();
...
// 'registerObject()' returns a subclass clone of 'object',
// and its relationship subgraph with all the private fields
object = context.registerObject(object);


Andrus