zeroDateTimeBehavior=convertToNull

來源:互聯網
上載者:User

針對以下這個,我覺得這樣做是可取的:

3)每個欄位盡量設定不可為空白,對於有些業務比如訂單的出倉時間確實需要等到出倉掃描時才有值的可以允許為空白;



供參考的解決方案:

全部欄位都設定為not null,

int ,date,datetime,timestamp類型都可以default 0 


orm層配置增加如下:

zeroDateTimeBehavior=convertToNull



這樣代碼層面無需任何改動。()

一來兼顧db層面的最佳化,資料量大並發時,這種摳門是可取的,

二來兼顧tms業務.


時間緊迫,可針對大表。






ps:

set datetime = null 它會清到 0.,,是的,。,但不能 統一標準啊。

把所有 time 有關的改成not null default 0 .. 代碼 把UPDATE seq_rule SET test_date=null 改成 UPDATE seq_rule SET test_date=0   可以

這樣的話,,就可以統一所有time類型

單是db層面的話
timestamp類型 + not null default 0 . + UPDATE seq_rule SET test_date=0
可以解決  ,java層面?


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.