You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by lyl <ly...@staff.cn99.com> on 2003/08/07 03:07:17 UTC

Why not insert null?

Hi!

I have a mysql table, one field is TIMESTAMP,
When i insert a record use PB.store(), though the TIMESTAMP field is
null in the object, but actually the sql statement inserted a TIMESTAMP
according current time。


thanx.
-- 
lyl <ly...@staff.cn99.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Why not insert null?

Posted by Thomas Mahler <th...@web.de>.
Hi,

I see only two reasons why OJB would write values into a timestamp column:
1. you have set the attribute locking="true" in the field-descriptor
2. you are using a ConversionStrategy that modifies the column.

cheers,
Thomas

lyl wrote:
> Thanks for ketan's response, but I don't think it is  caused by mysql, I
> used p6spy , the spy.log indicate that the insert statement replace null
> with current time. I think it is ojb who do that job.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Why not insert null?

Posted by lyl <ly...@staff.cn99.com>.
Thanks for ketan's response, but I don't think it is  caused by mysql, I
used p6spy , the spy.log indicate that the insert statement replace null
with current time. I think it is ojb who do that job.
-- 
lyl <ly...@staff.cn99.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Why not insert null?

Posted by Ketan Gangatirkar <ke...@ketan.org>.
That is how nulls work in MySQL with the TIMESTAMP column type.  If you
insert a null or assign a column to null, it will fill in the current time.

See here:

http://www.mysql.com/doc/en/DATETIME.html

lyl wrote:

> Hi!
> 
> I have a mysql table, one field is TIMESTAMP,
> When i insert a record use PB.store(), though the TIMESTAMP field is
> null in the object, but actually the sql statement inserted a TIMESTAMP
> according current time。
> 
> 
> thanx.



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org