英文:
Is there any way to change the datatype of a field when generated a table through @Entity Annotation in JPA Springboot?
问题
如何在使用JPA和SpringBoot的@Entity注解生成字段时更改字段的数据类型?我有一个名为Product的类,其中包含一个名为productId的字段,其数据类型为UUID,而JPA生成了二进制类型的字段。
英文:
How to change the data type of the field when generated through @Entity Annotation using JPA and SpringBoot? I have a class name as Product which contains a field name as productId having a data type of UUID and JPA generated the field of type binary.
答案1
得分: 0
尝试使用 @Type 注解,并将类型字段设置为 "uuid-char",问题得以解决。请查看下面的代码片段:
@Type(type = "uuid-char")
UUID productId;
英文:
Tried to use @Type annotation with type field sets to "uuid-char" and it solved the problem. Please find below snippet.
@Type(type = "uuid-char)
UUID productId;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论