From 664a7165bc6338832e1054bbe903b3f6d2e42d8a Mon Sep 17 00:00:00 2001 From: mathan26 Date: Tue, 4 Aug 2020 18:08:37 +0530 Subject: [PATCH] fix: @Type(type="uuid-char") add for UUID Cause: In h2 databse failed to store as uuid type Failed to convert value of type 'java.lang.String' to required type 'java.util.UUID --- .../guru/springframework/sfgrestdocsexample/domain/Beer.java | 2 ++ src/main/resources/application.properties | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/main/java/guru/springframework/sfgrestdocsexample/domain/Beer.java b/src/main/java/guru/springframework/sfgrestdocsexample/domain/Beer.java index 7e8f36c9..5884b93b 100644 --- a/src/main/java/guru/springframework/sfgrestdocsexample/domain/Beer.java +++ b/src/main/java/guru/springframework/sfgrestdocsexample/domain/Beer.java @@ -3,6 +3,7 @@ import lombok.*; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Type; import org.hibernate.annotations.UpdateTimestamp; import javax.persistence.*; @@ -25,6 +26,7 @@ public class Beer { @GeneratedValue(generator = "UUID") @GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator") @Column(length = 36, columnDefinition = "varchar", updatable = false, nullable = false) + @Type(type="uuid-char") private UUID id; @Version diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b137891..5cb2ef46 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,4 @@ +logging.level.org.springframework.web=DEBUG +spring.h2.console.enabled=true +