1

I need to store images in a database, so I decided with a table design to accommodate it. The table design is

FILE_ID INT,
FILE_NAME VARCHAR(200),
FILE_CONTENTS BLOB.

I'm using Oracle database. I think Oracle supports BLOB upto 2 GB of storage. I'm using hibernate as the JPA provider. The model class is annotated with Hibernate annotations where the blob field is with the byte[] (byte array type). If the image size is with few megabytes then the hibernate can bring the contents into the memory. If the size of the contents is more than the size of the jvm, how is hibernate accomplishing to bring the contents into the memory?

1
  • can you post the line which stores the image into DB , how are you saving it , converting in to byte array or what ?? Commented Jan 25, 2013 at 8:46

2 Answers 2

2

Do not use byte arrays for these purposes. Use sql Blob type, and work with it using streams.

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

1 Comment

Hi can you suggest me with the references
1

Hibernate is not going to be able to pull the contents to memory because there will be not enough memory where to pull it. You will end up with an OutOfMemoryException.

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.