@Entuty
@Table(name="sample")
public class SampleRecord {
@Column(name = "id")
private long id;
@Column(name = "name")
private String name;
//abridgement
}
Exception in thread "main" org.hibernate.AnnotationException: No identifier specified for entity: com.sample.jpa.SampleRecord
It seems that you have to specify @ Id
when using @ Entity
@Embeddable
@Table(name="sample")
public class SampleRecord {
@Column(name = "id")
private long id;
@Column(name = "name")
private String name;
//abridgement
}
When I tried using @Embeddable
, I was able to do it without a compilation error.