我已經定義了一個具有「java.util.UUID」作爲其「Id」字段的域類。將UUID作爲字段映射到mysql數據庫中錯誤的列類型
@Entity
class Response{
@Id
@GeneratedValue(generator = "myUUIDGenerator")
@GenericGenerator(name = "myUUIDGenerator", strategy = "uuid2")
@Column(columnDefinition = "uuid")
private UUID id;
...
}
我正在使用liquibase來生成數據庫。
<createTable tableName="response">
<column name="id" type="uuid">
<constraints primaryKey="true" nullable="false"/>
</column>
</createTable>
MySQL中生成的表將生成的id列描述爲「char(36)」。
運行測試用例時發生問題。它表示以下並沒有執行任何測試用例。
Wrong column type in DBNAME_response for column id. Found: char, expected: uuid