0

I've got a table with the following structure:

int id | blob file_to_store | int version  

This is how my domain works:

@Entity
@Table(name = "FileToStore")
public class FileToStore{

    @Id
    @Column(name = "id")
    private int Id;

    @Column(name = "version")
    private int version;

    @Column(name = "file_to_store")
    @Lob
    private Blob file;

    //gets and sets
}

Sometimes I just need a file version. Like this :

FileToStore fileToStore=FileToStoreService.get(id);
return fileToStore.getVersion();

Is that going to work fast or I have to write another SQL query to take version field only to avoid loading file? Oracle documentation says

Blob object contains a logical pointer to the SQL BLOB data rather than the data itself

Tony
  • 3,605
  • 14
  • 52
  • 84

1 Answers1

0

I guess your question boils down to wether Hibernate fetches lobs lazily. And based on discussion here Spring, Hibernate, Blob lazy loading I would advise to test it on your evnironment.

Community
  • 1
  • 1