JTS - Hibernate + Postgres + UUID冲突

时间:2016-11-19 08:39:37

标签: java postgresql hibernate hibernate-spatial

我正在使用Hibernate 5.0 + Postgres 9.4

我的实体使用UUID作为标识符。

该项目还使用hibernate-spatial

id属性仅注释为

@Id
@GeneratedValue
private UUID id;

在持久化任何实体(不仅是具有几何数据的实体)后,我收到以下错误:

column "id" is of type geometry but expression is of type uuid

看起来在我的类型中存在一些冲突;虽然我不是Hibernate类型映射的专家。

有没有人可以帮我解决这个问题?

1 个答案:

答案 0 :(得分:3)

结帐this answer和原始discussion thread

指定columnDefinition = "uuid"为我解决了完全相同的问题。

@Entity
public class MyEntity {
    @Id
    @GeneratedValue
    @Column( columnDefinition = "uuid", updatable = false )
    public UUID getId() {
        return id;
    }
}
相关问题