JPA primary key problem
How to use annotations for this classes:
publicclass Document
{
privateint id;
...
}
publicclass DocumentItem
{
privateint id;
private Document document;
...
}
to obtain that schema (especially primary key constraint for table documentitem):
create table document(
id decimal not null,
...,
primary key(id)
)
create table documentitem(
id decimal not null,
document_id decimal not null,
...,
primary key(id, document_id)
)
alter table documentitem add constraint fk_documentitem_1
foreign key (document_id) references document

