By the way, I'm using Cayenne 3.1M4-SNAPSHOT.

> I don't really know what you're doing, but what about something like this:
> 
> class POJO {
>     CayenneDataObject delegate;
> 
>     public POJO() {
>     }
> 
>     public setDelegate(CayenneDataObject cdo) {
>          this.delegate = cdo;
>     }
> 

I wish it were this simple. But the problem lies in
        DataContext#newObject(String entityName)
once it has created an instance of my POJO, it type casts it to 
Persistent:
            object = (Persistent) descriptor.createObject();

This *forces* my POJO to implement Persistent.

Is there another way to create an instance of my POJO ?


Why doesn't Cayenne support composition over inheritance? I think 
the idea of containing the CayenneDataObject as suggested provides 
much greater flexibility... and you generate these classes, anyway.

Reply via email to