java - Hibernate interprets NULL timestamp as current date/time -


i have mysql database table column called expirationdate, defined timestamp defaults null. have method pulls records table match various criteria, prints column values each record part of debugging routine.

when viewing records returned, noticed records have null expirationdate in db being returned program expirationdate set current date/time.

is normal behavior? if so, configurable (i'd value remain null)?

i using hibernate 3.x libraries.

it's not hibernate turning null values current timestamps, it's mysql. @ least that's probable reason. behaviour of timestamp column depends on multiple parameters:

  • whether it's first timestamp column in table (different defaults apply)
  • the table engine (myisam or innodb)
  • the configuration (maxdb setting)
  • your mysql version

of course behaviour sufficiently defined, in regard timestamp , null values, yet remains confusing. stopped using many mysql automagical features, e. g. because there other people have deal code , tables later.

you should check values in table , output of create table mysql command line client or pma. have null values in tables?

if had tables created hibernate 3, generated ddl statements might wrong (see this post).


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -