Search code examples
javamysqlspring-bootjpauuid

Is there any way to change the datatype of a field when generated a table through @Entity Annotation in JPA Springboot?


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.


Solution

  • 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;