Problems mapping UUID in JPA/hibernate

前端 未结 6 1143
既然无缘
既然无缘 2020-12-05 10:20

According to the documentation, hibernate 3.6 should have support for the java.util.UUID type. But when I map it like:

@Id protected UUID uuid;
6条回答
  •  独厮守ぢ
    2020-12-05 10:53

    Don't use the type UUID, because you'd need a custom type to handle it.

    Use String. See this post. It is one way of implementing it.

    Another way is to use the UUID generator built in hibernate. You'd need @GeneratedValue with a generator named hibernate-uuid

提交回复
热议问题