You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Michael Gentry <bl...@gmail.com> on 2019/11/27 12:06:27 UTC
Lazy Attributes
I just happened across an article on Hibernate which talks about lazy
attributes. (A recent addition, I think.) This essentially allows you to
flag an attribute/column as lazy and it'll be excluded from the original
SELECT query, but if you call the getter it will then fetch it in. This is
convenient for BLOB-type data that might happen to be in a main table with
other attributes (such as MIME types, file sizes, file names, etc).
Thoughts on maybe adding this feature to Cayenne? I can imagine there'd be
a "Lazy" column in Cayenne Modeler for the attributes to control/identify
them.
Thanks,
mrg
Re: Lazy Attributes
Posted by Andrus Adamchik <an...@objectstyle.org>.
Keep on dreaming. We may end up with a really nice feature spec :)
> On Nov 29, 2019, at 6:57 PM, Hugi Thordarson <hu...@karlmenn.is> wrote:
>
> This sounds very nice…
>
> To do a little dreaming, it would be even more awesome if property lazyness was controllable on a per-query basis, usage requirements tend to be quite dependent on context.
>
> A bit like a ColumnSelect that still allows you to keep all your fancy DataObject business logic intact :).
>
> ObjectSelect
> .query( BigEntity.class )
> .lazyProperties( BigEntity.HUGE_IMAGE, BigEntity.MASSIVE_STRING )
>
> - hugi
>
>
>
>> On 29 Nov 2019, at 15:25, Michael Gentry <bl...@gmail.com> wrote:
>>
>> Well, we can't always control the DB schema we have to interface with...
>>
>>
>> On Fri, Nov 29, 2019 at 5:30 AM Maik Musall <ma...@selbstdenker.ag> wrote:
>>
>>> I’ll add a little caveat though. If a query hits lots of rows and thus the
>>> optimizer decides to do a full table scan (or a partition scan), the
>>> database could still end up having to read the blobs from disk, only
>>> omitting them in the returned results. So there may still be
>>> performance-related reasons to keep such blobs in separate entities (or
>>> elsewhere), depending on the specific RDBMS and it’s configuration.
>>>
>>>> Am 29.11.2019 um 07:07 schrieb Lon Varscsak <lo...@gmail.com>:
>>>>
>>>> Yeah, it's a great idea.
>>>>
>>>> On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag>
>>> wrote:
>>>>
>>>>> +1 sounds very useful to simplify the data model here and there
>>>>>
>>>>>> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
>>>>>>
>>>>>> I just happened across an article on Hibernate which talks about lazy
>>>>>> attributes. (A recent addition, I think.) This essentially allows you
>>>>> to
>>>>>> flag an attribute/column as lazy and it'll be excluded from the
>>> original
>>>>>> SELECT query, but if you call the getter it will then fetch it in.
>>> This
>>>>> is
>>>>>> convenient for BLOB-type data that might happen to be in a main table
>>>>> with
>>>>>> other attributes (such as MIME types, file sizes, file names, etc).
>>>>>>
>>>>>> Thoughts on maybe adding this feature to Cayenne? I can imagine
>>> there'd
>>>>> be
>>>>>> a "Lazy" column in Cayenne Modeler for the attributes to
>>> control/identify
>>>>>> them.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> mrg
>>>>>
>>>>>
>>>
>>>
>
Re: Lazy Attributes
Posted by Michael Gentry <bl...@gmail.com>.
Well, update the JIRA I just created! :-)
https://issues.apache.org/jira/browse/CAY-2641
On Fri, Nov 29, 2019 at 10:57 AM Hugi Thordarson <hu...@karlmenn.is> wrote:
> This sounds very nice…
>
> To do a little dreaming, it would be even more awesome if property
> lazyness was controllable on a per-query basis, usage requirements tend to
> be quite dependent on context.
>
> A bit like a ColumnSelect that still allows you to keep all your fancy
> DataObject business logic intact :).
>
> ObjectSelect
> .query( BigEntity.class )
> .lazyProperties( BigEntity.HUGE_IMAGE, BigEntity.MASSIVE_STRING )
>
> - hugi
>
>
>
> > On 29 Nov 2019, at 15:25, Michael Gentry <bl...@gmail.com> wrote:
> >
> > Well, we can't always control the DB schema we have to interface with...
> >
> >
> > On Fri, Nov 29, 2019 at 5:30 AM Maik Musall <ma...@selbstdenker.ag>
> wrote:
> >
> >> I’ll add a little caveat though. If a query hits lots of rows and thus
> the
> >> optimizer decides to do a full table scan (or a partition scan), the
> >> database could still end up having to read the blobs from disk, only
> >> omitting them in the returned results. So there may still be
> >> performance-related reasons to keep such blobs in separate entities (or
> >> elsewhere), depending on the specific RDBMS and it’s configuration.
> >>
> >>> Am 29.11.2019 um 07:07 schrieb Lon Varscsak <lo...@gmail.com>:
> >>>
> >>> Yeah, it's a great idea.
> >>>
> >>> On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag>
> >> wrote:
> >>>
> >>>> +1 sounds very useful to simplify the data model here and there
> >>>>
> >>>>> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
> >>>>>
> >>>>> I just happened across an article on Hibernate which talks about lazy
> >>>>> attributes. (A recent addition, I think.) This essentially allows
> you
> >>>> to
> >>>>> flag an attribute/column as lazy and it'll be excluded from the
> >> original
> >>>>> SELECT query, but if you call the getter it will then fetch it in.
> >> This
> >>>> is
> >>>>> convenient for BLOB-type data that might happen to be in a main table
> >>>> with
> >>>>> other attributes (such as MIME types, file sizes, file names, etc).
> >>>>>
> >>>>> Thoughts on maybe adding this feature to Cayenne? I can imagine
> >> there'd
> >>>> be
> >>>>> a "Lazy" column in Cayenne Modeler for the attributes to
> >> control/identify
> >>>>> them.
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> mrg
> >>>>
> >>>>
> >>
> >>
>
>
Re: Lazy Attributes
Posted by Hugi Thordarson <hu...@karlmenn.is>.
This sounds very nice…
To do a little dreaming, it would be even more awesome if property lazyness was controllable on a per-query basis, usage requirements tend to be quite dependent on context.
A bit like a ColumnSelect that still allows you to keep all your fancy DataObject business logic intact :).
ObjectSelect
.query( BigEntity.class )
.lazyProperties( BigEntity.HUGE_IMAGE, BigEntity.MASSIVE_STRING )
- hugi
> On 29 Nov 2019, at 15:25, Michael Gentry <bl...@gmail.com> wrote:
>
> Well, we can't always control the DB schema we have to interface with...
>
>
> On Fri, Nov 29, 2019 at 5:30 AM Maik Musall <ma...@selbstdenker.ag> wrote:
>
>> I’ll add a little caveat though. If a query hits lots of rows and thus the
>> optimizer decides to do a full table scan (or a partition scan), the
>> database could still end up having to read the blobs from disk, only
>> omitting them in the returned results. So there may still be
>> performance-related reasons to keep such blobs in separate entities (or
>> elsewhere), depending on the specific RDBMS and it’s configuration.
>>
>>> Am 29.11.2019 um 07:07 schrieb Lon Varscsak <lo...@gmail.com>:
>>>
>>> Yeah, it's a great idea.
>>>
>>> On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag>
>> wrote:
>>>
>>>> +1 sounds very useful to simplify the data model here and there
>>>>
>>>>> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
>>>>>
>>>>> I just happened across an article on Hibernate which talks about lazy
>>>>> attributes. (A recent addition, I think.) This essentially allows you
>>>> to
>>>>> flag an attribute/column as lazy and it'll be excluded from the
>> original
>>>>> SELECT query, but if you call the getter it will then fetch it in.
>> This
>>>> is
>>>>> convenient for BLOB-type data that might happen to be in a main table
>>>> with
>>>>> other attributes (such as MIME types, file sizes, file names, etc).
>>>>>
>>>>> Thoughts on maybe adding this feature to Cayenne? I can imagine
>> there'd
>>>> be
>>>>> a "Lazy" column in Cayenne Modeler for the attributes to
>> control/identify
>>>>> them.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> mrg
>>>>
>>>>
>>
>>
Re: Lazy Attributes
Posted by Michael Gentry <bl...@gmail.com>.
Well, we can't always control the DB schema we have to interface with...
On Fri, Nov 29, 2019 at 5:30 AM Maik Musall <ma...@selbstdenker.ag> wrote:
> I’ll add a little caveat though. If a query hits lots of rows and thus the
> optimizer decides to do a full table scan (or a partition scan), the
> database could still end up having to read the blobs from disk, only
> omitting them in the returned results. So there may still be
> performance-related reasons to keep such blobs in separate entities (or
> elsewhere), depending on the specific RDBMS and it’s configuration.
>
> > Am 29.11.2019 um 07:07 schrieb Lon Varscsak <lo...@gmail.com>:
> >
> > Yeah, it's a great idea.
> >
> > On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag>
> wrote:
> >
> >> +1 sounds very useful to simplify the data model here and there
> >>
> >>> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
> >>>
> >>> I just happened across an article on Hibernate which talks about lazy
> >>> attributes. (A recent addition, I think.) This essentially allows you
> >> to
> >>> flag an attribute/column as lazy and it'll be excluded from the
> original
> >>> SELECT query, but if you call the getter it will then fetch it in.
> This
> >> is
> >>> convenient for BLOB-type data that might happen to be in a main table
> >> with
> >>> other attributes (such as MIME types, file sizes, file names, etc).
> >>>
> >>> Thoughts on maybe adding this feature to Cayenne? I can imagine
> there'd
> >> be
> >>> a "Lazy" column in Cayenne Modeler for the attributes to
> control/identify
> >>> them.
> >>>
> >>> Thanks,
> >>>
> >>> mrg
> >>
> >>
>
>
Re: Lazy Attributes
Posted by Maik Musall <ma...@selbstdenker.ag>.
I’ll add a little caveat though. If a query hits lots of rows and thus the optimizer decides to do a full table scan (or a partition scan), the database could still end up having to read the blobs from disk, only omitting them in the returned results. So there may still be performance-related reasons to keep such blobs in separate entities (or elsewhere), depending on the specific RDBMS and it’s configuration.
> Am 29.11.2019 um 07:07 schrieb Lon Varscsak <lo...@gmail.com>:
>
> Yeah, it's a great idea.
>
> On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag> wrote:
>
>> +1 sounds very useful to simplify the data model here and there
>>
>>> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
>>>
>>> I just happened across an article on Hibernate which talks about lazy
>>> attributes. (A recent addition, I think.) This essentially allows you
>> to
>>> flag an attribute/column as lazy and it'll be excluded from the original
>>> SELECT query, but if you call the getter it will then fetch it in. This
>> is
>>> convenient for BLOB-type data that might happen to be in a main table
>> with
>>> other attributes (such as MIME types, file sizes, file names, etc).
>>>
>>> Thoughts on maybe adding this feature to Cayenne? I can imagine there'd
>> be
>>> a "Lazy" column in Cayenne Modeler for the attributes to control/identify
>>> them.
>>>
>>> Thanks,
>>>
>>> mrg
>>
>>
Re: Lazy Attributes
Posted by Lon Varscsak <lo...@gmail.com>.
Yeah, it's a great idea.
On Thu, Nov 28, 2019 at 6:06 AM Maik Musall <ma...@selbstdenker.ag> wrote:
> +1 sounds very useful to simplify the data model here and there
>
> > Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
> >
> > I just happened across an article on Hibernate which talks about lazy
> > attributes. (A recent addition, I think.) This essentially allows you
> to
> > flag an attribute/column as lazy and it'll be excluded from the original
> > SELECT query, but if you call the getter it will then fetch it in. This
> is
> > convenient for BLOB-type data that might happen to be in a main table
> with
> > other attributes (such as MIME types, file sizes, file names, etc).
> >
> > Thoughts on maybe adding this feature to Cayenne? I can imagine there'd
> be
> > a "Lazy" column in Cayenne Modeler for the attributes to control/identify
> > them.
> >
> > Thanks,
> >
> > mrg
>
>
Re: Lazy Attributes
Posted by Maik Musall <ma...@selbstdenker.ag>.
+1 sounds very useful to simplify the data model here and there
> Am 27.11.2019 um 13:06 schrieb Michael Gentry <bl...@gmail.com>:
>
> I just happened across an article on Hibernate which talks about lazy
> attributes. (A recent addition, I think.) This essentially allows you to
> flag an attribute/column as lazy and it'll be excluded from the original
> SELECT query, but if you call the getter it will then fetch it in. This is
> convenient for BLOB-type data that might happen to be in a main table with
> other attributes (such as MIME types, file sizes, file names, etc).
>
> Thoughts on maybe adding this feature to Cayenne? I can imagine there'd be
> a "Lazy" column in Cayenne Modeler for the attributes to control/identify
> them.
>
> Thanks,
>
> mrg
Re: Lazy Attributes
Posted by Andrus Adamchik <an...@objectstyle.org>.
I'd be +1 on this. Thought about it in the past. Shouldn't be too hard to do either.
Andrus
> On Nov 27, 2019, at 3:06 PM, Michael Gentry <bl...@gmail.com> wrote:
>
> I just happened across an article on Hibernate which talks about lazy
> attributes. (A recent addition, I think.) This essentially allows you to
> flag an attribute/column as lazy and it'll be excluded from the original
> SELECT query, but if you call the getter it will then fetch it in. This is
> convenient for BLOB-type data that might happen to be in a main table with
> other attributes (such as MIME types, file sizes, file names, etc).
>
> Thoughts on maybe adding this feature to Cayenne? I can imagine there'd be
> a "Lazy" column in Cayenne Modeler for the attributes to control/identify
> them.
>
> Thanks,
>
> mrg