i'm trying to create tabel entity with composite primary key.
so i tried to create @Embeddable
class with all the primary keys and use @EmbeddedId
on the field that represents the primary keys. but i get this error:
Caused by: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
i wos tried to follow this link bat noting work what i'm doing wrong?
here is my code
DocEntity
@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
}
DocID
@Embeddable
public class DocID implements Serializable
{
private static final long serialVersionUID = 1L;
@Column(name = "DocName")
@JsonProperty
@NotEmpty
protected String docName;
@Column(name = "DocVersion")
@JsonProperty
@NotEmpty
protected String docVersion;
// getters, setters ,equals, hashCode
}
what i'm doing wrong?