我在这个类中有baseEntity class.the id属性,没有设置@Id和@GeneratedValue注解
@MappedSuperclass
@Getter
@Setter
@NoArgsConstructor
public abstract class BaseEntity<T> implements Serializable {
private T id;
@NotNull
@Column(name = "createdby", updatable = false)
@JsonIgnore
private String createdBy;
@NotNull
@Column(name = "updatedby")
@JsonIgnore
private String updatedBy;
public BaseEntity(T id) {
super();
this.id = id;
}
}
博客实体集@Id和@GeneratedValue
@Entity
@Table(name = "core_blog")
@Getter
@Setter
public class Blog extends BaseEntity<Long> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "subject", nullable = false)
private String subject;
@Lob
@Column(name = "body")
private String body;
}
但是我得到了一个例外
`No identifier specified for entity: org.roshan.framework.domain.blog.Blog`
我不知道我做错了什么?
发布于 2019-09-24 06:47:11
检查是否导入了javax.persistence.Id
类。
https://stackoverflow.com/questions/58067315
复制相似问题