I am trying to use
@Audited @Entity @Data
@Table(name = "users")
@SuperBuilder()
@NoArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@EntityListeners(AuditingEntityListener.class)
public class User {
@Column(nullable = false, unique = true)
private String email;
}
I have used this before, not sure what has changed recently;
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.7.3</version>
@Column(nullable = false, unique = true)
private String email;
enabling unique columns on this field or any other generate error;
SQL Error: 23505, SQLState: 23505
Unique index or primary key violation: "PUBLIC.UK_6DOTKOTT2KJSP8VW4D0M25FB7_INDEX_4 ON PUBLIC.USERS(EMAIL NULLS FIRST) VALUES ( /* 1 */ 'zzuser@abc.com' )"; SQL statement:
I must be overlooking something, can someone suggest a solution to this issue?
I am using H2 in @DataJPATest
parent class is as follows;
@Id
@GeneratedValue(generator = "UUID")
protected K uid;
@Version
private int version;