How to prevent Cayenne from fetching BLOB fields ?

View: New views
5 Messages — Rating Filter:   Alert me  

How to prevent Cayenne from fetching BLOB fields ?

by Pierre Lavignotte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I use Apache Cayenne for a while now with no problem, but I went into a new
issue today.

I have an Oracle data table containing 2 BLOB fields.
When I get the rows from this table, Cayenne also fetches the BLOB data, so
the query is veeeeery long, or I get a time out exception.

I tryed :

SelectQuery query = new SelectQuery(MyClass.class);
query.setFetchingDataRows(false);
context.performQuery(query);

and to define an Object Select Query in the modeler but the result is the
same.

What I would like is the BLOB data to be fetched only on demand, when I call
the myEntity.getMyBlobField() method.

Did I miss someting ?


Thank you for your help,
Pierre

RE: How to prevent Cayenne from fetching BLOB fields ?

by Scott A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Someone asked a similar question before - the clever solution was to map
the field in the modeler as if it were part of a separate table.

-----Original Message-----
From: Pierre Lavignotte [mailto:pierre.lavignotte@...]
Sent: Tuesday, October 07, 2008 12:26 PM
To: user@...
Subject: How to prevent Cayenne from fetching BLOB fields ?

Hello,

I use Apache Cayenne for a while now with no problem, but I went into a
new
issue today.

I have an Oracle data table containing 2 BLOB fields.
When I get the rows from this table, Cayenne also fetches the BLOB data,
so
the query is veeeeery long, or I get a time out exception.

I tryed :

SelectQuery query = new SelectQuery(MyClass.class);
query.setFetchingDataRows(false);
context.performQuery(query);

and to define an Object Select Query in the modeler but the result is
the
same.

What I would like is the BLOB data to be fetched only on demand, when I
call
the myEntity.getMyBlobField() method.

Did I miss someting ?


Thank you for your help,
Pierre

Re: How to prevent Cayenne from fetching BLOB fields ?

by Pierre Lavignotte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Scott.

I didn't find this in the mail archive...

Do you mean define an entity WITHOUT the BLOB fields, and another, pointing
on the same table, WITH ONLY the BLOB fields ?
I guess it will work but I thought there was a built in mechanism to handle
the BLOB fields differently than the standard ones...

Pierre

On Tue, Oct 7, 2008 at 6:29 PM, Scott Anderson <sanderson@...>wrote:

> Someone asked a similar question before - the clever solution was to map
> the field in the modeler as if it were part of a separate table.
>
> -----Original Message-----
> From: Pierre Lavignotte [mailto:pierre.lavignotte@...]
> Sent: Tuesday, October 07, 2008 12:26 PM
> To: user@...
> Subject: How to prevent Cayenne from fetching BLOB fields ?
>
> Hello,
>
> I use Apache Cayenne for a while now with no problem, but I went into a
> new
> issue today.
>
> I have an Oracle data table containing 2 BLOB fields.
> When I get the rows from this table, Cayenne also fetches the BLOB data,
> so
> the query is veeeeery long, or I get a time out exception.
>
> I tryed :
>
> SelectQuery query = new SelectQuery(MyClass.class);
> query.setFetchingDataRows(false);
> context.performQuery(query);
>
> and to define an Object Select Query in the modeler but the result is
> the
> same.
>
> What I would like is the BLOB data to be fetched only on demand, when I
> call
> the myEntity.getMyBlobField() method.
>
> Did I miss someting ?
>
>
> Thank you for your help,
> Pierre
>



--
Cordialement,
Pierre Lavignotte
Ingénieur Conception & Développement
http://pierre.lavignotte.googlepages.com

Re: How to prevent Cayenne from fetching BLOB fields ?

by Tore Halset :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

On 7. okt.. 2008, at 18.37, Pierre Lavignotte wrote:

> Thanks Scott.
>
> I didn't find this in the mail archive...
>
> Do you mean define an entity WITHOUT the BLOB fields, and another,  
> pointing
> on the same table, WITH ONLY the BLOB fields ?
> I guess it will work but I thought there was a built in mechanism to  
> handle
> the BLOB fields differently than the standard ones...

I did some work on streaming blob support a while back, but I did not  
complete the work. As far as I remember, it worked pretty well for  
reading.

https://issues.apache.org/cayenne/browse/CAY-316

Regards,
  - Tore.


Re: How to prevent Cayenne from fetching BLOB fields ?

by Malcolm Edgar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One pattern we use to address this is to make a child table which
contains the blob field and a parent foreign key.  Its not ideal but
it works.

regards Malcolm Edgar

On Wed, Oct 8, 2008 at 7:11 AM, Tore Halset <halset@...> wrote:

> Hello.
>
> On 7. okt.. 2008, at 18.37, Pierre Lavignotte wrote:
>
>> Thanks Scott.
>>
>> I didn't find this in the mail archive...
>>
>> Do you mean define an entity WITHOUT the BLOB fields, and another,
>> pointing
>> on the same table, WITH ONLY the BLOB fields ?
>> I guess it will work but I thought there was a built in mechanism to
>> handle
>> the BLOB fields differently than the standard ones...
>
> I did some work on streaming blob support a while back, but I did not
> complete the work. As far as I remember, it worked pretty well for reading.
>
> https://issues.apache.org/cayenne/browse/CAY-316
>
> Regards,
>  - Tore.
>
>
LightInTheBox - Buy quality products at wholesale price!