title: Data truncation: Data too long for column 'content' at row 1
body: <blockquote>
    <p>*Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'content' at row 1</p>
  </blockquote>
  
  <p>I'm try to solve this problem many days</p>
  
  <p>Name:vivek srivastava<br>
  Desc:Contact person<br>
  File:file<br>
  ContentType:application/pdf<br>
  service:managed,co-location<br>
  Hibernate: insert into documents (address, contact, content, mobileno, name, poname, serviceprovided, status, uploaddate) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
  org.hibernate.exception.DataException: could not insert: [com.ams.bean.Document]</p>
  
  <pre><code>package com.ams.bean;
  
  import java.sql.Blob;
  import java.sql.Date;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Lob;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="documents")
  public class Document {
  
      @Id
      @GeneratedValue
      @Column(name="id")
      private Integer id;
  
      @Column(name="name")
      private String name;
  
      @Column(name="poname")
      private String poname;
  
      @Column(name="mobileno")
      private String mobileno;
  
      @Column(name="contact")
      private String contact;
  
      @Column(name="content")
      @Lob
      private Blob content;
  
      @Column(name="serviceprovided")
      private String serviceprovided;
  
      @Column(name="status")
      private String status;
  
      @Column(name="uploaddate")
      private String uploaddate;
  
      @Column(name="address")
      private String address;
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getMobileno() {
          return mobileno;
      }
  
      public void setMobileno(String mobileno) {
          this.mobileno = mobileno;
      }
  
      public String getContact() {
          return contact;
      }
  
      public void setContact(String contact) {
          this.contact = contact;
      }
  
      public Blob getContent() {
          return content;
      }
  
      public void setContent(Blob content) {
          this.content = content;
      }
  
      public String getServiceprovided() {
          return serviceprovided;
      }
  
      public void setServiceprovided(String serviceprovided) {
          this.serviceprovided = serviceprovided;
      }
  
      public String getStatus() {
          return status;
      }
  
      public void setStatus(String status) {
          this.status = status;
      }
  
      public String getUploaddate() {
          return uploaddate;
      }
  
      public void setUploaddate(String uploaddate) {
          this.uploaddate = uploaddate;
      }
  
      public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      }
  
      public String getPoname() {
          return poname;
      }
  
      public void setPoname(String poname) {
          this.poname = poname;
      }enter code here
  
  
  }
  
      @RequestMapping(value = "/save", method = RequestMethod.POST)
      public String save(
              @ModelAttribute("document") Document document,
              @RequestParam("file") MultipartFile file) {
  
  
          System.out.println("Name:" + document.getName());
          System.out.println("Desc:" + document.getContact());
          System.out.println("File:" + file.getName());
          System.out.println("ContentType:" + file.getContentType());
          System.out.println("service:"+document.getServiceprovided());
  
          try {
              Blob blob = Hibernate.createBlob(file.getInputStream());
  
              document.setServiceprovided(document.getServiceprovided());
              document.setContent(blob);
              document.setAddress(document.getAddress());
              document.setName(document.getName());
              document.setPoname(document.getPoname());
              document.setMobileno(document.getMobileno());
              document.setStatus(document.getStatus());
              document.setUploaddate(document.getUploaddate());
              document.setContact(document.getContact());
  
  
  
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          try {
              VMDao.save(document);
          } catch(Exception e) {
              e.printStackTrace();
          }
  
          return "redirect:/customer_details.do";
      }
  
        @Transactional(propagation=Propagation.REQUIRED)
          public void save(Document document) {
              Session session = sessionFactory.getCurrentSession();
              session.save(document);
          }
  </code></pre>