UUID
@Id
@Type(type = "org.hibernate.type.PostgresUUIDType")
private UUID id = UUID.randomUUID();
dao
public interface DemoDao extends JpaRepository<Demo,UUID> {
public Demo findById(UUID uuid);
}
使用
Demo demo =demoDao.findById(UUID.fromString("127757ac-571c-9052-cdd9-a31f91d15972"));