title: Value '0000-00-00' can not be represented as java.sql.Date
body: <p>I'm working on some project which needs to extract data from DB and I use Spring MVC to build model from DB for selecting data.</p>
  
  <p>Here is the problem with my <strong>JSP page:</strong></p>
  
  <pre><code>&lt;form action="result" method="get" &gt;
  &lt;table&gt;
  &lt;thead&gt;
  &lt;tr&gt;
  &lt;th&gt;Date to select:&lt;/th&gt;
  &lt;th&gt;Name to select:&lt;/th&gt;
  &lt;th&gt;Type to select:&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;form:select  path="listOfDates"&gt;
  &lt;form:option value="NONE"&gt; --SELECT--&lt;/form:option&gt;
  &lt;form:options items="${listOfDates}"&gt;&lt;/form:options&gt;
  &lt;/form:select&gt;
  &lt;/td&gt;  
  &lt;td&gt;&lt;form:select  path="listOfInstitutionsNames"&gt;
  &lt;form:option value="NONE"&gt; --SELECT--&lt;/form:option&gt;
  &lt;form:options items="${listOfInstitutionsNames}"&gt;&lt;/form:options&gt;
  &lt;/form:select&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;form:select  path="listOfInstitutionsTypes"&gt;
  &lt;form:option value="NONE"&gt; --SELECT--&lt;/form:option&gt;
  &lt;form:options items="${listOfInstitutionsTypes}"&gt;&lt;/form:options&gt;
  &lt;/form:select&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  
  &lt;tfoot&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;input type="submit" value="Извлечь"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tfoot&gt;
  
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>As you can see I try to use <code>&lt;form:select&gt;</code> from <code>Spring</code> tag library.<br/>
  <strong>Question:</strong><br/>but when it's preparing my model with this <strong>controller:</strong></p>
  
  <pre><code>@Controller
  public class HomeController{ 
  
      @Autowired
      private ControllerSupportClass controllerSupportClass; 
  
  
          @RequestMapping(value="/search", method=RequestMethod.GET)
          public String search(Model model) {
              List&lt;Date&gt; listOfDates = controllerSupportClass.findAllDatesForm();
              List&lt;String&gt; listOfInstitutionsNames = controllerSupportClass.findAllInstitutionsForm();
              List&lt;String&gt; listOfInstitutionsTypes = controllerSupportClass.findAllTypesForm();
              model.addAttribute("listOfInstitutionsTypes", listOfInstitutionsTypes);
              model.addAttribute("listOfInstitutionsNames", listOfInstitutionsNames);
              model.addAttribute("listOfDates", listOfDates);
              return "search";    
          }
  
  
          @RequestMapping(value ="/result", method=RequestMethod.GET)
          public String SecondActionPage(@RequestParam String particularDate, 
                                         @RequestParam String nameOfInstitution, 
                                         @RequestParam String typeName,
                                         Model model) throws Exception {
  
  
                  if(particularDate !="" &amp;&amp; nameOfInstitution.trim() !="" &amp;&amp; typeName.trim()=="") {                   
                      controllerSupportClass.findWithDateAndName(nameOfInstitution, particularDate, model);                   
                  } else if(particularDate.trim() !="" &amp;&amp; nameOfInstitution.trim() =="" &amp;&amp; typeName.trim() !="") {                    
                      controllerSupportClass.findWithAddedDateAndType(typeName, particularDate, model);                   
                  } else if(particularDate.trim() !="" &amp;&amp; nameOfInstitution.trim() =="" &amp;&amp; typeName.trim() ==""){         
                      controllerSupportClass.findWithAddedDate(particularDate, model);    
                  } else if(particularDate.trim() !="" &amp;&amp; nameOfInstitution.trim() !="" &amp;&amp; typeName.trim() !="") {
                      throw new Exception("Search by choose all parameters is not exceptable");   
                  } else {    
                      throw new Exception("You didn't put any search parameters");    
                  }           
              return "search";
          }
  
  }
  </code></pre>
  
  <p><strong>It gives me an error like this:</strong></p>
  
  <blockquote>
    <p>WARN : org.springframework.web.servlet.PageNotFound - No mapping found
    for HTTP request with URI [/controller/] in DispatcherServlet with
    name 'appServlet' Hibernate: select distinct creationda0_.DATE_ID as
    DATE1_0_, creationda0_.CHILD_ADMISSION_DATE as CHILD2_0_,
    creationda0_.CHILD_GO_SCHOOL_DATE as CHILD3_0_,
    creationda0_.PARTICULAR_DATE as PARTICULAR4_0_, creationda0_.VERSION
    as VERSION0_ from CREATION_DATE creationda0_ WARN :
    org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState:
    S1009 ERROR: org.hibernate.util.JDBCExceptionReporter - Value
    '0000-00-00' can not be represented as java.sql.Date Jun 19, 2013
    3:26:53 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet [appServlet] in context with
    path [/controller] threw exception [Request processing failed; nested
    exception is org.hibernate.exception.GenericJDBCException: could not
    execute query] with root cause java.sql.SQLException: Value
    '0000-00-00' can not be represented as java.sql.Date</p>
  </blockquote>
  
  <p>If you need my Entity class it's here I'm using <code>Date</code> from <code>java.util</code>, but I go with <code>@Temporal</code> annotation to convert it from SQL to unit <code>Date</code> as I understand:</p>
  
  <pre><code>@Entity
  @Table(name="CREATION_DATE")
  public class CreationDate implements Serializable {
  
  
      private int dateId;
  
          @Id
          @GeneratedValue(strategy=IDENTITY)
          @Column(name="DATE_ID")
          public int getDateId() {
              return dateId;
          }
  
          public void setDateId(int dateId) {
              this.dateId = dateId;
          }
  
  
      private int version;
  
          @Version
          @Column(name="VERSION")
          public int getVersion() {
              return version;
          }
  
          public void setVersion(int version) {
              this.version = version;
          }
  
  
      private Date particularDate;
  
          @Temporal(TemporalType.DATE)
          @DateTimeFormat(pattern="yyyy-MM-dd")
          @Column(name="PARTICULAR_DATE")
          public Date getParticularDate() {
              return particularDate;
          }
  
          public void setParticularDate(Date particularDate) {
              this.particularDate = particularDate;
          }
  
  
      private Date childGoSchoolDate;
  
          @Temporal(TemporalType.DATE)
          @DateTimeFormat(pattern="yyyy-MM-dd")
          @Column(name="CHILD_GO_SCHOOL_DATE")
          public Date getChildGoSchoolDate() {
              return childGoSchoolDate;
          }
  
          public void setChildGoSchoolDate(Date childGoSchoolDate) {
              this.childGoSchoolDate = childGoSchoolDate;
          }
  
  
      private Date childAdmissionDate;
  
          @Temporal(TemporalType.DATE)
          @DateTimeFormat(pattern="yyyy-MM-dd")
          @Column(name="CHILD_ADMISSION_DATE")
          public Date getChildAdmissionDate() {
              return childAdmissionDate;
          }
  
          public void setChildAdmissionDate(Date childAdmissionDate) {
              this.childAdmissionDate = childAdmissionDate;
          }
  
  
  }
  </code></pre>
  
  <p>Assuming that the problem with data type conversion is because MVC uses <code>String</code>, but the actual type is <code>Date</code>.</p>