如何在JPA / Hibernate中使用字符串类型的@Id?
我有一个实体,其中包含字符串类型的主键。此实体模型如下所示:
@Entity
public class MyEntity {
@Id
@Column(name="PR_KEY", unique=true)
private String prKey;
....
....
}
但是我面临着类型不匹配的问题。
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.String, got class java.lang.Long