The java.sql.Timestamp class has a static method  called valueOf to convert Strings in the format yyyy-mm-dd hh:mm:ss.fffffffff  (where ffffffffff represents nanoseconds) to a java.sql.Timestamp instance.  As pointed out previously, this is easier than writing your own converter.  See Javadocs for java.sql.Timestamp for more info.

In your  Entity Bean class you would declare the field like the following:

public abstract java.sql.Timestamp getstartDate();

public abstract void setStartDate(java.sql.Timestamp newStartDate);

And then you can use Timestamp.valueOf(String yourStartDateAsString) to convert as appropriate.




Reply via email to