在初次使用hibernate的过程中,出现了两个问题。

一:Data too long for column 'ID' at row 1

二:时间格式问题

针对第一个问题代码如下

Data too long for column 'ID' at row 1 的问题

通过UUID.randomUUID().toString()生成的字符串出现了Data too long for column 'ID' at row 1 的异常,故我将字符串打印出来发现超过了我的初设的长度,因此使用substring方法截取即可。

第二个错误是因使用了较新版本的mysql中常见的问题,因此需要在url上加参数,参数如下所示。

<property name="connection.url">jdbc:mysql://localhost:3306/test1?characterEncoding=utf8&amp;serverTimezone=UTC</property>

相关文章:

  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
猜你喜欢
  • 2021-08-11
  • 2021-07-19
  • 2021-09-20
  • 2021-09-06
  • 2021-11-30
相关资源
相似解决方案