According to this article https://vladmihalcea.com/hibernate-and-uuid-identifiers/ I wanted to generate with hibernate UUID to my class. IntelliJ says that 'Cannot resolve 'GenericGenerator' '. It doesnt recognize the GenericGenerator import neither.
Entity.java:
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import org.hibernate.annotations.GenericGenerator;
@MappedSuperclass
public abstract class Entity {
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
@Column(columnDefinition = "CHAR(32)")
@Id
protected String id;
public BaseEntity() {
}
}
I have these dependencies in my build.gradle:
compile group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'
runtime group: 'org.hibernate', name: 'hibernate-core', version: '5.4.9.Final'