Hi,

i am using the primefaces fileupload widget, so users can upload attatchment files. right now, i save the files on the filesystem and i persist the path to the file in the database.

is there a way to save files as BLOB in relational database?

Thank you for your answers!

asked 26.05.2016 at 16:59

joha0123's gravatar image

joha0123
(suspended)
accept rate: 0%


Yes, it's possible, e.g. by using JPA (aka Ivy Persistence). You have to write the JPA class by yourself (instead of using the persistence editor) so that you can use the @Lob annotation on the field.

BUT: If there is no real requirement (e.g. transaction support) to store files in the database, the filesystem is a good choice. It’s a common question, the question is-it-a-bad-practice-to-store-large-files-10-mb-in-a-database on stackexchange could help.

link

answered 31.05.2016 at 12:59

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦
(suspended)
accept rate: 75%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×32
×18
×5

Asked: 26.05.2016 at 16:59

Seen: 2,489 times

Last updated: 31.05.2016 at 12:59