commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knight, Digby" <Digby_Kni...@hen.invesco.com>
Subject [beanutils] preparedStement.setObject(1, BeanUtils.getProperty(be an, "createdDate"))
Date Tue, 08 Apr 2003 08:21:36 GMT
This maybe slightly off topic, but does anyone know why the following code
writes nulls to my created_date column?

PreparedStatement pstmt = conn.prepareStatement("update table set
created_date=?");
pstmt.setObject(1, BeanUtils.getProperty(bean, "createdDate"));
pstmt.execute();

for a (populated) bean:

public Bean {
	java.util.Date createdDate;
	set...
	get...
}

and created_date is a MySQL column of type DATE.

I guess it's something to do with java.sql.Date? I'm setting the columns in
a loop, so don't know the column types in advance. There's been no problem
doing the opposite and reading from the db.

Thanks...

Digby


*****************************************************************
The information in this email and in any attachments is 
confidential and intended solely for the attention and use 
of the named addressee(s). This information may be 
subject to legal professional or other privilege or may 
otherwise be protected by work product immunity or other 
legal rules.  It must not be disclosed to any person without 
our authority.

If you are not the intended recipient, or a person 
responsible for delivering it to the intended recipient, you 
are not authorised to and must not disclose, copy, 
distribute, or retain this message or any part of it.
*****************************************************************


Mime
View raw message