title: Saving HTML data in a field using BLOB or TEXT/CLOB
body: <p>I need to <strong>store a page of html data</strong> in a field called ProjectDescription in mySQL database using Spring &amp; JPA 2.1 . I have read <a href="https://stackoverflow.com/q/7626585/6043669">this question</a>  and all other questions with BLOB tag, but need some clarity on why the fields are saving in a certain manner in my db. I have created the fields in the manner below using both String and byte[] field types.</p>
  <p><strong>Method1</strong>: Saving data as TEXT (After encoding in Base64 format I save my html data as String using the below method)</p>
  <pre><code>@Basic(fetch = FetchType.LAZY) 
  @Lob
  private String projectDescription = &quot;&quot;;
  </code></pre>
  <p><strong>Method2</strong>: Saving data as binary using BLOB</p>
  <pre><code>@Basic(fetch = FetchType.LAZY)
  @Lob
  @Column(length=5000)
  private byte[]  projectDescription1 =new byte[0];
  </code></pre>
  <p>My assumptions:
  I assume that since a page of html data is not very large, TEXT is ok as comapred to BLOB</p>
  <p>I tested both and the fields are saved as below in mySQL database</p>
  <blockquote>
  <p>In <strong>Method1:</strong></p>
  <ol>
  <li>Type: TEXT</li>
  <li>DisplaySize is constantly 1431655765.</li>
  </ol>
  <p>This size doesn't change irrespective of my @Column(length=5000)
  annotaton.</p>
  <p>In <strong>Method2</strong></p>
  <ol>
  <li>Type: BLOB</li>
  <li>DisplaySize: -1</li>
  </ol>
  </blockquote>
  <p><strong>Question1:</strong> What is the source of this DisplaySize ? This seems quite large in case of TEXT and very small(-1) in case of byte[] field type. Why doesn't @Column length seem to change change the DisplaySize.</p>
  <p><strong>Question2:</strong> Is it ok to store HTML data as String field type(eventually as TEXT) as opposed to byte[] (eventually as a blob)?</p>
  <p>Note: I have read all the questions with BLOB tags and am clear that images/documents need to be saved as BLOB and text as as CLOB/TEXT. However, would like to confirm again for HTML data given how large DisplaySize is allocated in DB for TEXT.</p>
  <p>Thanks.</p>