You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marek Šabo <ms...@buk.cvut.cz> on 2010/11/08 01:37:10 UTC

Composite entity model

Hi all,

Would it be possible to generate entities not as children of 
CayenneDataobject but as self composite objects with a CDO field? I'm 
not gonna ask for implementation - I'm just curios if I may redefine 
such behavior in my projects. Because sometimes we work with API that 
really, really screws with inheritance, for one, JAXB marshalls all the 
way to the top and to stop such behavior one has to annotate every 
superclass, which is nonsense.

As you have much deeper insight into Cayenne, would it be reasonable to 
try this?

Thanks for opinions, regards,

-- 
Marek Šabo



Re: Using query results on relatioships

Posted by Aristedes Maniatis <ar...@maniatis.org>.
http://cayenne.apache.org/doc/prefetching.html


On 10/11/10 11:38 AM, Bruno René Santos wrote:
> Hello all,
>
> I have a doubt about performance on cayenne (or probably ORM's in general...).
> Imagine a table B that has a foreign key to table A and also a foreign key to
> table C. You have a query that returns 1000 A's to a form where you have a table
> that shows all B's that belong to A. Also on each row you show a field of the
> table C.
>
> What happens, logically, is that for each row a query is made to fetch the C
> object related to B, 1000 times...
>
> What do you suggest I could do to only do a query to table C and make Cayenne
> get objects from that result to populate B's relationship with C? Is there some
> simple way to do this and still maintain the proper relationship between B and
> C?
>
> Thanx
> Bruno Santos
>

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Using query results on relatioships

Posted by Bruno René Santos <br...@holos.pt>.
Hello all,

I have a doubt about performance on cayenne (or probably ORM's in general...).
Imagine a table B that has a foreign key to table A and also a foreign key to
table C. You have a query that returns 1000 A's to a form where you have a table
that shows all B's that belong to A. Also on each row you show a field of the
table C.

What happens, logically, is that for each row a query is made to fetch the C
object related to B, 1000 times...

What do you suggest I could do to only do a query to table C and make Cayenne
get objects from that result to populate B's relationship with C? Is there some
simple way to do this and still maintain the proper relationship between B and
C?

Thanx
Bruno Santos


Re: Composite entity model

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Nov 9, 2010, at 8:15 PM, Marek Šabo wrote:

> 
> @Andrus: what you have in mind is new implementation of JAXB or just some sort of marshalling support for CDOs?

JAXB, although I don't see myself doing it in the nearest future.

Andrus

Re: Composite entity model

Posted by Marek Šabo <sa...@fit.cvut.cz>.
Hi,

thanks, that looks good, I'll check it out later today.

@Andrus: what you have in mind is new implementation of JAXB or just 
some sort of marshalling support for CDOs?

Regards,
-- 

Marek Šabo


On 11/09/2010 11:32 PM, Andrus Adamchik wrote:
> Hi Malcolm,
>
> thanks! I guess that can be used as a basis for a JAXB marshaller implementation.
>
> (BTW, I received the attachment in a copy of a message that was sent to my bypassing the list and it was stripped from the list message).
>
> Andrus
>
> On Nov 9, 2010, at 5:14 PM, Malcolm Edgar wrote:
>
>> Hi Guys,
>>
>> Please take a look at the attached code which marshalls between ValueObject (POJO) and CDO.
>>
>> regards Malcolm Edgar
>>
>> On Wed, Nov 10, 2010 at 7:26 AM, Andrus Adamchik<an...@objectstyle.org>  wrote:
>> I wish somebody just wrote a marshaller for CDO. One day I may do it if nobody beats me on it.
>>
>> Andrus
>>
>> On Nov 7, 2010, at 7:37 PM, Marek Šabo wrote:
>>
>>> Hi all,
>>>
>>> Would it be possible to generate entities not as children of CayenneDataobject but as self composite objects with a CDO field? I'm not gonna ask for implementation - I'm just curios if I may redefine such behavior in my projects. Because sometimes we work with API that really, really screws with inheritance, for one, JAXB marshalls all the way to the top and to stop such behavior one has to annotate every superclass, which is nonsense.
>>>
>>> As you have much deeper insight into Cayenne, would it be reasonable to try this?
>>>
>>> Thanks for opinions, regards,
>>>
>>> --
>>> Marek Šabo
>>>
>>>
>>>
>>
>



Re: Composite entity model

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Malcolm, 

thanks! I guess that can be used as a basis for a JAXB marshaller implementation. 

(BTW, I received the attachment in a copy of a message that was sent to my bypassing the list and it was stripped from the list message).

Andrus

On Nov 9, 2010, at 5:14 PM, Malcolm Edgar wrote:

> Hi Guys,
> 
> Please take a look at the attached code which marshalls between ValueObject (POJO) and CDO.
> 
> regards Malcolm Edgar
> 
> On Wed, Nov 10, 2010 at 7:26 AM, Andrus Adamchik <an...@objectstyle.org> wrote:
> I wish somebody just wrote a marshaller for CDO. One day I may do it if nobody beats me on it.
> 
> Andrus
> 
> On Nov 7, 2010, at 7:37 PM, Marek Šabo wrote:
> 
> > Hi all,
> >
> > Would it be possible to generate entities not as children of CayenneDataobject but as self composite objects with a CDO field? I'm not gonna ask for implementation - I'm just curios if I may redefine such behavior in my projects. Because sometimes we work with API that really, really screws with inheritance, for one, JAXB marshalls all the way to the top and to stop such behavior one has to annotate every superclass, which is nonsense.
> >
> > As you have much deeper insight into Cayenne, would it be reasonable to try this?
> >
> > Thanks for opinions, regards,
> >
> > --
> > Marek Šabo
> >
> >
> >
> 
> 


Re: Composite entity model

Posted by Malcolm Edgar <me...@apache.org>.
Hi Guys,

Please take a look at the attached code which marshalls between ValueObject
(POJO) and CDO.

regards Malcolm Edgar

On Wed, Nov 10, 2010 at 7:26 AM, Andrus Adamchik <an...@objectstyle.org>wrote:

> I wish somebody just wrote a marshaller for CDO. One day I may do it if
> nobody beats me on it.
>
> Andrus
>
> On Nov 7, 2010, at 7:37 PM, Marek Šabo wrote:
>
> > Hi all,
> >
> > Would it be possible to generate entities not as children of
> CayenneDataobject but as self composite objects with a CDO field? I'm not
> gonna ask for implementation - I'm just curios if I may redefine such
> behavior in my projects. Because sometimes we work with API that really,
> really screws with inheritance, for one, JAXB marshalls all the way to the
> top and to stop such behavior one has to annotate every superclass, which is
> nonsense.
> >
> > As you have much deeper insight into Cayenne, would it be reasonable to
> try this?
> >
> > Thanks for opinions, regards,
> >
> > --
> > Marek Šabo
> >
> >
> >
>
>

Re: Composite entity model

Posted by Andrus Adamchik <an...@objectstyle.org>.
I wish somebody just wrote a marshaller for CDO. One day I may do it if nobody beats me on it.

Andrus

On Nov 7, 2010, at 7:37 PM, Marek Šabo wrote:

> Hi all,
> 
> Would it be possible to generate entities not as children of CayenneDataobject but as self composite objects with a CDO field? I'm not gonna ask for implementation - I'm just curios if I may redefine such behavior in my projects. Because sometimes we work with API that really, really screws with inheritance, for one, JAXB marshalls all the way to the top and to stop such behavior one has to annotate every superclass, which is nonsense.
> 
> As you have much deeper insight into Cayenne, would it be reasonable to try this?
> 
> Thanks for opinions, regards,
> 
> -- 
> Marek Šabo
> 
> 
>