Yes, I'm sorry if I wasn't clear.   The wrapping of CayenneDataObject
would be handled in your own code.

It's definitely possible -- I used this kind of a strategy for a while
with a project that could support either JPA or Cayenne as a back-end.
Generated code was the key for me to keep it manageable -- instead of
generating only CayenneDataObjects, I also generated the JPA classes
as well as the wrapping classes.

On Mon, Dec 12, 2011 at 1:28 AM, Andrus Adamchik <[email protected]> wrote:
>
> On Dec 11, 2011, at 7:00 PM, Kevin Meyer - KMZ wrote:
>
>> 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.
>
> You may have to do the wrapping on your own after that I guess... If it is at 
> all possible.
>
> IIRC elsewhere in this thread you said you were OK with Isis objects 
> extending CayenneDataObject. CayenneDataObject implements Persistent of 
> course. So maybe there was some misunderstanding earlier in this discussion? 
> If your object really has to be a POJO (as in Java class with no special 
> superclass and data contained in the user-defined fields), we need to 
> backtrack quite a bit and reevaluate the problem.
>
>> 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.
>
> In the Isis integration case - maybe. I don't think we've ever considered 
> using a delegate to give persistent objects a semblance of a POJO by removing 
> a requirement for a superclass, but still forcing our own internal structure. 
> So it is probably worth a discussion, although I am cautiously pessimistic 
> about it being done easily at Cayenne level.
>
> Andrus
>

Reply via email to