我正在尝试使用复合主键创建tabel实体。
所以我尝试使用所有主键创建SELECT t.*, r.*
FROM t INNER JOIN
r
ON t._id = r.r_identifier
WHERE r.r_date = (SELECT MAX(r2.r_date)
FROM r r2
WHERE r.r_identifier = r2.r_identifier
);
类,并在表示主键的字段上使用@Embeddable
。但我得到这个错误:
@EmbeddedId
我试图按照这个link蝙蝠注意工作 我做错了什么?
这是我的代码
DocEntity
Caused by: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
DocID
@Entity(name = "doc")
@Table(name = "doc")
public class DocEntity extends baseDataBase implements Serializable
{
private static final long serialVersionUID = 1L;
@EmbeddedId
private DocID docID;
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "DocID")
@JsonProperty
@NotEmpty
private short id;
@Column(name = "DocDescription")
@JsonProperty
@NotEmpty
private String docDescription;
@Column(name = "DocPath")
@JsonProperty
@NotEmpty
private String docPath;
// getters, setters ,equals, hashCode
}
我做错了什么?