Hi Andrus
Thanks, I have done something like that:
I created an ObjEntity called ImageMeta without the BLOB field, and then
another ObjEntity called ImageBlob with just the BLOB field.
I then added a method to ImageMeta that retrieves ImageBlob when required.
This pattern works great for selects, but not for inserts because BLOB may
not be null.
So I created an ObjEntity called ImageNew (that inherited from ImageMeta)
that has all the needed fields for a successful insertion.
However this degraded the performance of ImageMeta selects because Cayenne
was now retrieving the BLOBs as well.
Jurgen
-----Original Message-----
From: Andrus Adamchik
Sent: Friday, December 20, 2013 10:25 AM
To: [email protected]
Subject: Re: Inheritance Question
If your result list is not expected to contain ClassTwo objects, you won’t
see any blobs. But if it is - you will get fully resolved ClassTwo objects,
including the BLOB attribute.
So perhaps BLOB should be placed in a separate table and lazily resolved via
relationship?
Andrus
On Dec 20, 2013, at 10:49 AM, [email protected] wrote:
Thanks for asking Andrus:
Because ClassTwo contains a BLOB that I don't want retrieved when asking
for ClassOne objects.
Jurgen
-----Original Message----- From: Andrus Adamchik
Sent: Friday, December 20, 2013 8:58 AM
To: [email protected]
Subject: Re: Inheritance Question
No.
But a question though - if the result set only contains ClassOne rows, why
would you care about inclusion of all those extra columns in the SELECT?
Andrus
On Dec 20, 2013, at 9:50 AM, [email protected] wrote:
Thanks for your reply Andrus.
I don't suppose that there is a way to tell Cayenne not to be so eager in
this case ?
Jurgen
-----Original Message----- From: Andrus Adamchik
Sent: Friday, December 20, 2013 8:27 AM
To: [email protected]
Subject: Re: Inheritance Question
From what I can tell, this is the intended behavior. If your SelectQuery
root is ClassOne, Cayenne expects that the result might contain a mix of
ClassOne and any of its subclasses (which means ClassTwo as well). So the
columns in SELECT are a superset of columns for all the classes involved.
Andrus
On Dec 12, 2013, at 12:30 PM, [email protected] wrote:
Hi All
I have a dbEntity say ClassOne (its lightweight) and another that
inherits from it as ClassTwo (its heavyweight).
Now in my case I have a prefetch that retrieves ClassOne objects.
The problem that I have is that Cayenne is fetching ClassTwo data as
well ?!
Surely Cayenne should only be fetching the ClassOne data, why is
ClassTwo data also being retrieved ?
Is this the intended behaviour ? Is there a way to prevent it ?
Thanks, Jurgen