<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can i persist a file as BLOB?</title><link>https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob</link><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;is there a way to save files as BLOB in relational database?&lt;/p&gt;
&lt;p&gt;Thank you for your answers!&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 31 May 2016 12:59:23 -0400</lastBuildDate><item><title>Answer by Flavio Sadeghi</title><link>https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob/1787</link><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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  &lt;a href="http://programmers.stackexchange.com/questions/150669/is-it-a-bad-practice-to-store-large-files-10-mb-in-a-database"&gt;is-it-a-bad-practice-to-store-large-files-10-mb-in-a-database&lt;/a&gt; on stackexchange could help.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Tue, 31 May 2016 12:59:23 -0400</pubDate><guid>https://answers.axonivy.com/questions/1779/how-can-i-persist-a-file-as-blob/1787</guid></item></channel></rss>