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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.