Skip to main content

Can I have a lazy loading for @Lob?

1 reply [Last post]
peppeme
Offline
Joined: 2007-05-30

I have a table A with a blob field (in mysql 5)
this blob contains a png data.

I have an entity that represent table A (entityA) [I use top link essential]
In this entity I have this mapping for blob field

@Lob
@Basic(fetch=FetchType.LAZY)
@Column(name = "screenshot")
private byte[] screenshot;

I wish to obtain a lazy loading (like collection in X to many relationship) for the screenshot field, in order to load it only when the property is accessed.

But when I debug my web application (where I retrieve the entityA thru session facade for entityA) the screenshot is loaded when the entityA instaces is created.

So, Is it possible to load the field only when it is accessed?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04

Some persistence vendors support it and some don't. TopLink Essentials doesn't.

-marina