ZeroDateTimeBehavior = convertToNull

Source: Internet
Author: User

For the following, I think this is desirable:

3) each field should be set as far as possible not to be empty. For some businesses such as the Order's warehouse picking time, it is required to wait until the warehouse picking scan to have a value;



Reference solutions:

All fields are set to not null,

The int, date, datetime, and timestamp types can all be set to default 0.


The following is added to the orm layer Configuration:

ZeroDateTimeBehavior = convertToNull



In this way, no changes are required at the code level. ()

This trick is desirable when database-level optimization is taken into account and a large amount of data is concurrent,

Second, consider tms business.


Time is tight, which can be applied to large tables.






Ps:

Set datetime = null it will be cleared to 0 .., yes ,., But the standards cannot be unified.

Change all time-related values to not null default 0 .. the code changes UPDATE seq_rule SET test_date = null to UPDATE seq_rule SET test_date = 0.

In this way, all time types can be unified.

Db alone
Timestamp type + not null default 0. + UPDATE seq_rule SET test_date = 0
Can it be solved at the java level?


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.