I wanted to have attributes that can be tagged as "lazily-loaded" like 
relationships, but that's not a feature yet. So what Ari said is the easiest 
solution. 

Another idea is to map the column as "java.sql.Blob", which is normally just a 
data locator that can stream data on demand. Though I suspect you will need to 
wrap both SELECT, and your Blob streaming code in the same transaction. Also 
the behavior of this will likely vary between DB engines. 

Disclaimer: I never tried it myself.

Andrus


> On Oct 3, 2019, at 3:43 AM, Aristedes Maniatis <[email protected]> wrote:
> 
> My solution has been to store the blob in a separate joined table or (better) 
> put it in external storage like S3.
> 
> Ari
> 
> On 3/10/19 9:55am, Lon Varscsak wrote:
>> Hey all,
>> 
>> I have a blob column in an entity, but I don't want to always actually load
>> the blob, just on demand (but I still want to be able to see the other
>> attributes in the entity).  Any best practice here to have the blob be lazy?
>> 
>> Thanks,
>> 
>> Lon
>> 

Reply via email to