Alice52 / project

This repository is muti language and tech integration project.
MIT License
0 stars 0 forks source link

[seckill] convert date time to UTC date #31

Open Alice52 opened 4 years ago

Alice52 commented 4 years ago
  1. consider convert all data time type to UTC when persisted to database by annotation

  2. 结合 java8 的 LocalDateTime

  3. 思路: 代码中可见的时间都是 local 时间

    • 存: 在存的时候 代码层面是 local 时区, 经过 jdbc 存入数据库时变成 UTC 时区
    • 取: 在取的时候经过 JDBC 时转换为 local 时区

reference

  1. https://stackoverflow.com/questions/508019/how-to-store-date-time-and-timestamps-in-utc-time-zone-with-jpa-and-hibernate/3430957

  2. https://stackoverflow.com/questions/9533935/how-to-force-hibernate-to-return-dates-as-java-util-date-instead-of-timestamp

Alice52 commented 4 years ago

mybatis

  1. considering to use TypeHandlerCallback
Alice52 commented 4 years ago

hibernate

  1. considering to use TimestampType and TimestampTypeDescriptor
Alice52 commented 4 years ago

now date time create in code will be utc time?

Alice52 commented 4 years ago

84 [seckill] mybtis issue list