问题描述
- Hibernate 自动生成日期值
-
<class name="com.traitswu.zone.entity.User" table="user"> <id name="id" type="int" column="id"> <generator class="native"/> </id> <property name="createDate" generated="insert" not-null="true" type="java.util.Date"> <column name="createDate" sql-type="timestamp" default="CURRENT_TIMESTAMP"/> </property> <property name="modifiedDate" generated="always" not-null="true" type="java.util.Date"> <column name="modifiedDate" sql-type="timestamp" default="CURRENT_TIMESTAMP"/> </property> <property name="userName" type="string" not-null="true" length="50" unique-key="account_unique"/> <property name="passWord" type="string" not-null="true" length="50" unique-key="account_unique"/> </class>
为什么没有自动生成日期值(exception: Caused by: java.sql.SQLException: Field 'createDate' doesn't have a default value)
解决方案
时间: 2025-01-01 20:08:25