geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Carew" <>
Subject Re: FindByPrimaryKey
Date Thu, 06 Apr 2006 12:44:39 GMT
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.

View raw message