title: What type of data record with the annotation @ Lob with JPA?
body: <p>I have a problem, When I'm recording a PDF file inside the bank, I better save as file or byte []?</p>
  
  <pre><code>@Lob @Basic(fetch=FetchType.EAGER)
  @Column(name="arqdocumento")
  private File arquivo; 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@Lob
  @Basic(fetch=FetchType.EAGER)
  @Column(name="arqdocumento")
  private byte[] arquivo; 
  </code></pre>
  
  <p>And how do I get this file from database and display in the browser?</p>
  
  <p>I wonder why I do it this way:</p>
  
  <pre><code>public File getDocumentoBinary(int iDdocumento){
     Query consulta = getSesseion().createSQLQuery("SELECT arqdocumento FROM documento WHERE iddocumento = :id");
     consulta.setInteger("id", iDdocumento);
     return  (File) consulta.uniqueResult();     }
  </code></pre>
  
  <p>but displays this error:</p>
  
  <p>Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -4</p>