commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Dunn" <>
Subject BeanUtils and Dates
Date Fri, 06 Dec 2002 18:32:53 GMT
I'm using BeanUtils to populate a bean with records from a resultSet via a
HashMap built using the metadata.getColumnName for property names and the
rst.getString for values in the usual way.  A date field in the resultSet
(we'll call it "myDate") is causing an exception.

Debug log shows ConvertUtils is attempting to "Convert string '2002-09-25
01:05:43.0' to class 'java.sql.Date'" but it cannot and throws a

My bean imports java.sql.Date, and the instance variable is:

	private Date myDate = null;

My setter is:

	public void setMyDate(Date myDate) {
		this.myDate = myDate;

How do I get the date into my bean as a date?  Am I stuck with setting it as
a String?


View raw message