1
com.vaadin.data.Property$ConversionException:
    java.lang.NoSuchMethodException:
    java.sql.Date.(java.lang.String)

What is the fix for this... here is my POJO class

package your.intermedix.domain;

import java.io.Serializable;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * Contact POJO.
 *
 * @hibernate.class table = "contact"
 * @hibernate.cache usage = "read-write"
 */

public class Contact implements Serializable {

    private static final long serialVersionUID = -8361595011677919387L;

    /**
     *
     * @hibernate.id    generator-class = "increment"
     *                  column = "clientid"
     */

    private Long id = null;

    /**
    *
    * @hibernate.property  column = "name"
    *                      length = "100"
    *                      not-null = "true"
    */
    private String name = null;

    /**
    *
    * @hibernate.property  column = "email"
    *                      length = "100"
    *                      not-null = "true"
    */

    private String email;

    /**
    *
    * @hibernate.property  column = "lastname"
    *                      length = "100"
    *                      not-null = "true"
    */
    private String lastname;

    /**
    *
    * @hibernate.property  column = "designation"
    *                      length = "100"
    *                      not-null = "true"
    */
    private String designation;

    /**
    *
    * @hibernate.property  column = "date"
    *                      length = "100"
    *                      not-null = "true"
    */

    private Date date;

    /**
    *
    * @hibernate.property  column = "comments"
    *                      length = "100"
    *                      not-null = "true"
    */

    private String comments;



    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    public String getDesignation(){
        return designation;
    }

    public void setDesignation(String designation){
        this.designation = designation;
    }


    public String getEmail(){
        return email;
    }

    public void setEmail(String email){
        this.email = email;
    }


    public String getLastname(){
        return lastname;
    }

    public void setLastname(String lastname){
        this.lastname= lastname;
    }


    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public Date getDate(){
        return date;
    }

    public void setDate(Date date){
        this.date = date;
    }

    public String getComments(){
        return comments;
    }

    public void setComments(String name){
        this.comments = comments;
    }


    public String toString()
    {
        return "designation = '" + designation + "',email='"+ email +"', lastname='"+ lastname +"', name = '" + name + "', date='" + date +"', comments='" + comments +"'";
    }

}
3

What about not using Date from java.sql package, but using from java.util?

| improve this answer | |
4

Exception that you got explains everythinh. java.sql.Date does not have a constructor that takes a string.. That is why you have got this exception. java.util.Date has such a constructor and it is deprecated. You can use SimpleDateFormat class to convert String to a Date object..

| improve this answer | |
1

The date field is declated as

/**     
 *
 * @hibernate.property  column = "date"
 *                      length = "100"
 *                      not-null = "true"
 */
 private Date date;

A date with length = 100? Can you try changing this?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.