Lob

For large binary or text content (database LOB) we can model it in the entity bean as a property of type java.io.File or byte[] and with @Lob.

@Entity
public class SomeFileBean {
  ...

  @Lob
  File content;

  @Lob
  byte[] content2;

Lazy fetched by default

By default all @Lob properties are fetched lazily, they are NOT fetched unless explicitly included in the select clause.

Note that File properties (and other Lob properties) will lazy load as needed.

QSomeFileBean b = QSomeFileBean.alias()

SomeFileBean bean =
  new QSomeFileBean()
    .select(b.name, b.content)
    .id.eq(42)
    .findOne();

File content = bean.getContent();