You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by robert burrell donkin <ro...@blueyonder.co.uk> on 2003/04/09 10:17:02 UTC
Re: [beanutils] preparedStement.setObject(1, BeanUtils.getProperty(be an, "createdDate"))
i can't help much just from looking at it.
i'd try adding some logging to discover whether it's the
BeanUtils.getProperty(bean, "createdDate") which is returning null (and
then whether the bean property is null or whether it's some kind of
beanutils issue) or whether using a string in a setObject against a DATE
column won't work.
- robert
On Tuesday, April 8, 2003, at 09:21 AM, Knight, Digby wrote:
> 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.
> *****************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>