I want to convert UUID value from bytes to string by using @Type annotation as:
@Type(type="uuid-char") but I am getting the error: The attribute type is undefined for the annotation type Type.
Import: import org.hibernate.annotations.Type;
Code:
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
@Column(name = "id", columnDefinition = "VARCHAR(40)")
@Type(type="uuid-char")
@JsonIgnore
private UUID id;
I also searched it here https://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e2794 but it had the same syntax I was using. What am I missing?
Try use
@JdbcTypeCode(SqlTypes.VARCHAR)instead.After updating to Spring Boot 3.0.0 we had the same problem. Using
@JdbcTypeCode(SqlTypes.VARCHAR)instead. I tried it out with PSQL.