title: How to convert Part to Blob, so I can store it in MySQL?
body: <p>How to convert Part to Blob, so I can store it in MySQL? It is an image.
  Thank you</p>
  
  <p>My form </p>
  
  <pre><code>&lt;h:form id="form" enctype="multipart/form-data"&gt;
          &lt;h:messages/&gt;
          &lt;h:panelGrid columns="2"&gt;
              &lt;h:outputText value="File:"/&gt;
              &lt;h:inputFile id="file" value="#{uploadPage.uploadedFile}"/&gt;
          &lt;/h:panelGrid&gt;
          &lt;br/&gt;&lt;br/&gt;
          &lt;h:commandButton value="Upload File" action="#{uploadPage.uploadFile}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>My bean</p>
  
  <pre><code>@Named
  @ViewScoped
  public class UploadPage {       
      private Part uploadedFile; 
  
      public void uploadFile(){
      }
  }
  </code></pre>