1

I am using JPA hibernate, wicket, weblogic, and oracle 11.

I have a Table, which has 8 columns, and one of them is a BLOB type. I store big XLS files in this BLOB. I am querying only 10 rows, but it takes a lot of time, I guess because of the big XLS files. I setted the blob type to be lazy in the entity:

@Basic(fetch=FetchType.LAZY)
@Lob
@Column(name = "EXCEL")
private Byte[] xls;

But it is as slow as before. How could I really set, to not to load the BLOB files, only if I querying the BLOBs?

victorio
  • 6,224
  • 24
  • 77
  • 113

1 Answers1

1

Using Lazy Properties Fetching

Hibernate3 supports the lazy fetching of individual properties. This optimization technique is also known as fetch groups. Please note that this is mostly a marketing feature; optimizing row reads is much more important than optimization of column reads. However, only loading some properties of a class could be useful in extreme cases. For example, when legacy tables have hundreds of columns and the data model cannot be improved.

Lazy property loading requires buildtime bytecode instrumentation. If your persistent classes are not enhanced, Hibernate will ignore lazy property settings and return to immediate fetching.

See Bytecode Instrumentation for Hibernate Using Maven.

Edwin Dalorzo
  • 76,803
  • 25
  • 144
  • 205