CREATE TABLE `users` (
`user_id` BINARY(16) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`password` VARCHAR(255) NOT NULL,
PRIMARY KEY (`user_id`)
);@Getter
@Entity
@Table(name = "users")
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor(access = PROTECTED)
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
public class User extends SoftDeleteBaseEntity {
@Id
@EqualsAndHashCode.Include
@Column(name = "user_id")
private UUID uuid;
@Column(name = "email")
private String email;
@Column(name = "password")
private String password;
}org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [user_id] in table [users]; found [varchar (Types#VARCHAR)], but expecting [binary(16) (Types#BINARY)]@Getter
@Entity
@Table(name = "users")
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor(access = PROTECTED)
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
public class User extends SoftDeleteBaseEntity {
@Id
@EqualsAndHashCode.Include
@Column(name = "user_id")
@Type(type = "org.hibernate.type.UUIDCharType") // UUID를 VARCHAR 형태로 저장
private UUID uuid;
@Column(name = "email")
private String email;
@Column(name = "password")
private String password;
}

@JdbcTypeCode(SqlTypes.VARCHAR) 로 타입 지정@Getter
@Entity
@Table(name = "users")
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor(access = PROTECTED)
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
public class User extends SoftDeleteBaseEntity {
@Id
@EqualsAndHashCode.Include
@UuidGenerator(style = RANDOM)
@JdbcTypeCode(SqlTypes.VARCHAR)
@Column(name = "user_id", columnDefinition = "VARCHAR(36)")
private UUID uuid;
@Column(name = "email")
private String email;
@Column(name = "password")
private String password;
}@UuidGenerator(style = RANDOM)로 UUID 랜덤 생성
테이블의 데이터 타입을 @JdbcTypeCode(SqlTypes.VARCHAR) 로 지정
💻 참고 사이트 : SpringBoot 3.0에서 @Type(type ="..")의 변경 (velog.io)